Forum OpenACS Development: AOLserver and malloc/free

Collapse
4: AOLserver and malloc/free (response to 1)
Posted by Andrew Piskorski on
Maurizio, you haven't really said what you want to use AOLserver for. What is your use case? Evalauating the technical merits of different esoteric approaches isn't very useful without that.

I think (could be wrong though) that whether a memory allocator is subject to fragmentation problems or not has little or nothing to do with whether or not the system uses garbage collection. It also doesn't necessarily have much to do with whether the applications memory use continues to grow over time either. Remember that the operating system malloc does not necessarily release memory from the process just because you call free to release it! (And that varies across platforms.) That's one of the things Zoran and the other Naviserver guys wrestled with in their VTMalloc work, I believe.

Also, I suspect that retrofitting a Boehm-Demers-Weiser conservative garbage collector to Tcl and AOLserver, while certainly doable, is unlikely to achieve your goals. "Conservative" garbage collectors are just that, conservative - they lack full knowledge of the application's memory use, and when unsure, leave memory uncollected. Thus, all conservative collectors leak to some degree over time. Whether or not that's a problem is a matter of use case and of degree, but it's why conservative collectors are reputed do be unsuitable for genuinely long running, high use, high reliability servers.

AFAIK, dropping a Boehm-Demers-Weiser garbage collector into existing C code is primarily a way to avoid having to fix your malloc/free bugs and/or to have code written in a garbage collected language interact well with C code, not a way to get perfectly leak free code. (Garbage collection is a truly wonderful feature, but it's no magic wand...) I suppose both using a conservative collector and carefully calling free() might work better than either alone - dunno, I have no practical experience there.

For a super reliable leak free long-running server, you want either an exact garbage collector (which requires language support, and thus is more complicated and cannot simply be dropped into existing C code), or you want what AOLserver already has - mannual malloc and free. And then track down the few remaining tricky leaks you've missed...

Collapse
Posted by Maurizio Martignano on
Dear Andrew, thanks a lot for your reply. I'm afraid the memory leak or, if you want, the continuos growth of the memory occupied by the combination Aolserver/OpenACS does not depend on my particular application. Just install OpenACS, move around some few pages (try for instance the included test pages) and have a look at the memory occupation.... you'll see that it is growing. So this is an endemic behaviour of the infrastructure and not of the particular applications put on top of it.

Cheers and thanks,
Maurizio