[Gc] memory leak in C++ (part II)
S M Ryan
wyrmwif at rawbw.com
Thu Jan 31 06:26:47 PST 2008
> Yesterday I sent one code fragment that I think that have an memory
> then Bruce help-me to understand that the code don't have a memory
> Than today I tried generate an new code fragment in C++ (using new
> with an leak that generate an gc.log that show leak, but I have no
If you retain a pointer to the memory, it is not a leak.
Objptr p[n]; for (i=0; i<n; i++) p[i] = new Obj;
Because p[i] is available on the stack and has a pointer, it is not a
for (i=0; i<n; i++) new Obj;
This does not retain all the pointers (maybe one or two in
registers), so the lost pointers are leaks if not collected.
More information about the Gc