Forum OpenACS Development: AOLserver and malloc/free
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...
Cheers and thanks,