Mail Archives: djgpp/2004/03/15/12:15:30
>Just for grins, I wanted to see how often deque would exercise new / delete.
BTW... I compiled that test snippet under Windows VC6 and it called new/delete
upon EVERY push() and pop() operation!
However, it appears that WIN is cleaning up the empty deque after I pop,
because
there's a huge malloc(4080) each time:
======win output=========
malloc (4080)=003261F8
malloc (8)=00430330
+delete 003261F8
delete 00430330
-  malloc (4080)=003261F8
malloc (8)=00430330
+delete 003261F8
delete 00430330
-  malloc (4080)=003261F8
[snip]
But if I push once before starting the loop so the deque never empties, then
the WIN
output is much nicer;  i.e.:
    D.push_back( 1 );
    for ( ...200... ) {
           D.push_back( 1 );
           D.pop_front( );
     }
WIN then generates this:
malloc (4096)=003251C0
malloc (8)=00430090
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
+-+-+-
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
+-+-+-
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
+-+-+-
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
+-+-+-
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
+-+-+-
delete 003251C0
delete 00430090
But the DJGPP version still has that funny delete / new operation about 3/4 of
the way through the 200-times loop, even if I keep the deque from emptying.
Dan
- Raw text -