on 25 Jul 2003 07:13:02 -0400,
Quote:> When using deque, what happens to the heap if you do a push_back and a
> pop_front once per second for a year?
Depending on the implementations of std::deque, std::allocator and your
heap, you'll probably find it keeps recycling the same block(s). (In
fact, given a literal interpretation of your question, it would be
reasonable for an implementation to only ever allocate a single block :)
Quote:> I am just wondering if using deque is appropriate in a program that is
> designed to run continuously for extended time periods.
I've certainly used std::deque it in such situations1 and not had any
problems with it. YMMV, however. If this is a great concern, you could
always write an allocator to do (what you consider to be) the right
1 It didn't have to run continuously for a year (the system admin types
didn't trust the underlying OS to run for that long :), but there were
considerably more than one access per end per second...
"Light thinks it travels faster than anything but it is wrong. No matter
how fast light travels it finds the darkness has always got there first,
and is waiting for it." -- Terry Pratchett, Reaper Man
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]