GC and memory leaks

Vladimir Panteleev thecybershadow at gmail.com
Sun Nov 11 10:44:44 PST 2007


On Sun, 11 Nov 2007 18:34:03 +0200, Ald Sannes <aldarri_s at yahoo.com> wrote:

> Yet the 800 Mbytes of memory are not being freed until the program terminates.

AFAIK, DMD's GC does not release memory back to the OS, ever.

Also, minimize() does nothing, and genCollect() does the same thing as fullCollect().

One thing you could try is Tango's GC, which in my experience behaves better in some circumstances. You can use Tangobos[1] to keep the Phobos API and use Tango's runtime (which includes the GC).

> To parse HTML, I used std.regesp.replace().  On some files, it loops, ate all memory in less than a minute and crashed.

std.regexp has some known issues. Unless you're in the mood to debug and fix it (which would be making all of us a favour), for real work you might be better off finding some libpcre wrappers. Just in case, first check that your input is valid UTF-8 - that got me once (broken UTF-8 sequences make std.regexp crash and burn).

There's also a compile-time regexp engine by Pragma and Don Clugston[2].

[1] http://dsource.org/projects/tangobos
[2] http://www.dsource.org/projects/ddl/browser/trunk/meta/regex.d

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



More information about the Digitalmars-d mailing list