STL objects in shared memory
Posted on 1997-10-17
I'd like to use STL containers & etc in a multi-threaded program, but I need to have any memory allocated by the container, and by any objects *in* the container, allocated from a shared memory arena. Furthermore, I have to be able to do this (relatively) portably between NT and various unixen (I use M$VC++ on NT and g++/libg++ on all the Unix boxes).
How do I force all new() and delete()s for container-related objects to be satisfied from a special pool?
Is there a common memory-manager template that can be given a chunk of memory to manage? It'll have to handle alloc/free, of course, but probably also need to coalesce fragments, because its "heap" will be of a fixed size.