[Gc] Re: Memory leak located!
martin.wartens at mymail.ch
Mon May 26 16:17:54 PDT 2008
> Whether or not it really fixes the allocator problem depends on whether
> the default allocator calls new directly or allocates large chunks with
> new and then divides them. I believe it's still common to do the latter.
> In that case, this change will probably help, but possibly only in the
> sense that it hides the underlying bug for longer. My recommendation
> would still be to explicitly use a garbage collecting allocator whenever
My implementation (Microsoft VC8) just calls new. But I don't know what the
standard says about that. What would be the problem with the large chunk thing?
When you forget gc_allocator in a program with mixed gc and non-gc the GC
cannot see pointers to garbage collected objects in the container. That leads
to a premature collection.
> Maybe the right solution is to introduce yet another macro, say
> GC_COLLECTABLE_NEW that controls the behavior of global operator new?
That sounds good and it is only a tiny change.
More information about the Gc