Any advice for GC/memory debugging
Sean Kelly
sean at invisibleduck.org
Mon Sep 1 10:57:16 PDT 2008
Alan Knowles wrote:
> Having fleshed out an SMTP server, I've now started testing it against a
> good load level.
>
> Apart from the various thread issues in phobos (getHostbyName is not
> thread safe etc./ using udns solved alot of this...) - my bigger worry
> is memory management.
>
> With GC enabled/or even disabled, the memory pool will rise to ~ 200Mb
> from the baseline of ~20K and run out of memory on the box it's running
> on. The test box we have peaks at about 30 concurrent
> connections/threads. - compiled using GDC (as it's FreeBSD)
>
> From what i've seen, there is no real way to disable the Garbage
> collection, in terms of stopping it from managing the
> allocation/deallocation of memory? as it is too intertwined in the
> management of things like char[] etc..
>
> Has anyone found good ways to analyze where the application may be
> leaking memory/allocating to much memory - hooks in the in/out
> properties of methods ?
With Tango you can attach a cleanupHandler and use it to dump info on
objects being collected. I'm planning to add more debugging features as
well, but they aren't in yet. However, on Tango I'd add some logging to
lib/gc/basic/gc.d and on Phobos I'd add it to internal/gc/gc.d.
> Is there any way to compact the memory, as the pool appears to jump
> quite dramatically from ~ 64k->100Mb->250Mb, even though it looks like
> the used pool is significantly smaller..
Tango offers a GC.minimize() routine that may help. I believe the same
routine is in Phobos as well but it's not actually implemented.
Sean
More information about the Digitalmars-d-learn
mailing list