[Issue 1804] New: Severe GC leaks with repetitive array allocations

Sean Kelly sean at f4.ca
Thu Jan 24 13:48:27 PST 2008


d-bugmail at puremagic.com wrote:
> 
> FYI: I tried running fullCollect() periodically, just in case...no luck.
> 
>   import std.stdio;
>   void main()
>   {
>     for(int i=1; ; i++)
>     {
>       auto tmp = new char[i*1024];
>       if(i % 1_000 == 0)
>         writefln("%d iterations, roughly %.1f MB", i,
> tmp.length/(1024*1024.0));
>     }
>   }

Interestingly, this app crashes in the same place if 'tmp' is deleted on
each iteration.  If I had to guess, I'd say that empty pools aren't
being added to the free list after collections, even though there's code
in place that's supposed to do this.  Perhaps it's just pools dedicated
to big allocations that are the problem.  This portion of the GC isn't
really my area of expertise, but I'll submit a patch if I can figure
this one out.


More information about the Digitalmars-d-bugs mailing list