M
Mark
If you have STL containers (like list, vector,...) in
functions as automatic variables, do the nodes that
are put on the containers get buffered so they can be reused
by later container operations?
For example, if I have 10 member methods, and lots of them have
a list <Foo*> when that list is cleared or goes out
of scope, the nodes are deleted (don't worry about deleting the
Foo* themselves, they are just extra pointers to classes in a
DB, in this program the list being cleared or out of scope doesn't
mean the pointers are lost and memory leaked)
But are they really deleted or does STL buffer them in a pool
somewhere so that the next method when it does
list<Foo*> mylist;
mylist.push_back(fooptr);
could just grab a node from a pool and put the fooptr in it
without newing a node? I've read that to do this buffering for
STL, you'd have to get a special allocator to do that.. implying
the default allocators you get with a compiler like Gcc don't
do buffering?
Mark
functions as automatic variables, do the nodes that
are put on the containers get buffered so they can be reused
by later container operations?
For example, if I have 10 member methods, and lots of them have
a list <Foo*> when that list is cleared or goes out
of scope, the nodes are deleted (don't worry about deleting the
Foo* themselves, they are just extra pointers to classes in a
DB, in this program the list being cleared or out of scope doesn't
mean the pointers are lost and memory leaked)
But are they really deleted or does STL buffer them in a pool
somewhere so that the next method when it does
list<Foo*> mylist;
mylist.push_back(fooptr);
could just grab a node from a pool and put the fooptr in it
without newing a node? I've read that to do this buffering for
STL, you'd have to get a special allocator to do that.. implying
the default allocators you get with a compiler like Gcc don't
do buffering?
Mark