GC and memory leaks

Vladimir Panteleev thecybershadow at gmail.com
Sun Nov 11 11:32:37 PST 2007


On Sun, 11 Nov 2007 21:10:26 +0200, Ald Sannes <aldarri_s at yahoo.com> wrote:

> Ok, let's then manage memory manually.  Where should I look for the leaks?  I already delete everything I declare; guess some memory is allocated behind the scenes?

D's "delete" statement does not return memory back to the OS - it just marks the block free for the GC to reuse in further reallocations. Truely "manual" memory management means that you'll have to use malloc/free from std.c.stdlib.

One workaround I could suggest is putting the code that has the one-time large memory requirement in a separate DLL. Since it'll have its own GC, the GC will release (almost [1]) all memory back to the OS when the DLL is unloaded. Note that Tango's runtime doesn't do this, and as far as I understood the Tango developers don't care much[2].

[1] http://d.puremagic.com/issues/show_bug.cgi?id=1551
[2] http://www.dsource.org/projects/tango/ticket/669

-- 
Best regards,
 Vladimir                          mailto:thecybershadow at gmail.com



More information about the Digitalmars-d mailing list