[Issue 1804] Severe GC leaks with repetitive array allocations

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Feb 5 10:48:55 PST 2008


http://d.puremagic.com/issues/show_bug.cgi?id=1804





------- Comment #3 from sean at f4.ca  2008-02-05 12:48 -------
Okay, I think I know what's going on.  For big allocations, the GC will look
for a pre-existing set of contiguous pages within a single pool to hold the
block.  If one cannot be found, then it creates a new pool of the requested
size to hold the block.  However, in this app the allocation size just
continuously increases, so as time goes on the GC is unable to re-use existing
pools and so allocates successively larger pools to hold the requested block. 
The problem is that all these old pools which were only used once are held by
the GC for future use, so the total memory used by the application steadily
increases, with most of this memory going completely unused.

The simplest fix in this case would be for the GC to always release pools
obtained for big allocations back to the OS when they are no longer needed. 
This should address the pathological case demonstrated in this test app.  I'm
going to make this change in Tango and see if it helps.


-- 



More information about the Digitalmars-d-bugs mailing list