Re: [GD-Linux] Reinitializing the heap
Brought to you by:
vexxed72
From: J C L. <cl...@ka...> - 2001-11-27 21:33:47
|
On Tue, 27 Nov 2001 13:20:39 -0800 Josh Adams <ja...@se...> wrote: > Hey all, Is it possible to reinitialize the standard libc malloc > heap during runtime? I would rather do this than try to make sure > every last bit of memory is cleaned up (it's a game after all). Not portably/reliably, well, not without just dropping your current context via something like an exec() which does the right VM things. If you can show your context out in a shm block this can work fairly nicely (you get recycled file handles, IPC structures etc as well which can be useful). > I'm looking for anything from an externed function I can call > (like __malloc_init) or getting the 'top' of the heap and setting > it to 0 or something like that. The easiest way to get this behaviour would be to write a local allocator which offered those semantics. I did this at one point with a head implementation that allowed watermarking. Basically you could make watermarks at various times, and then free all still-valid allocations back to the named watermark (yeah, single threaded with linear process flows). -- J C Lawrence ---------(*) Satan, oscillate my metallic sonatas. cl...@ka... He lived as a devil, eh? http://www.kanga.nu/~claw/ Evil is a name of a foeman, as I live. |