I run a simulation with a lot if I link the original memory allocations to the object. Modeling should be done as quickly as possible, but distribution speed is not important. I'm not interested in liberation.
Ideally, the allocator will place everything in a contiguous block of memory. (I think this is sometimes called the arena?)
I cannot use a flattened vector because the selected objects are polymorphic.
What are my options?
Just make your own.
Check out the old question to find out how to get started:
++?
-, . . malloc (x) x , (x). ,
, , , . , reset , , .
- , , , . boost: pool . , x - - .
, , . Memory-PDF. , . , , , ,
Boost.Pool?
- . : Lea, Robinson, Knowlton, Grunwald.
: , . , , , , : , , .
, , , ; ..
Foo *a = new Foo(); Bar *b = new Bar; b == ((byte *)(a)) + sizeof(Foo);
, , , . , , , ; , .
(MIT).
C . , , , , .
This is a pretty big thing, just take wikipedia . One specific example was in Alexandrescu's book and should be implemented in his Loki library . GCC also comes with several implementations std::allocator, just browse your distribution.
std::allocator