GC and memory leaks
Ald Sannes
aldarri_s at yahoo.com
Sun Nov 11 11:10:26 PST 2007
Vladimir Panteleev Wrote:
> 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).
.......
...
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?
> > 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).
>
Thanks. Actually, since all I need is to find text in HTML, a FSA, built with a huge two-level switch structure, proved to be sufficient.
More information about the Digitalmars-d
mailing list