From: Nicholas N. <nj...@ca...> - 2003-05-14 10:09:32
|
On 14 May 2003, Crispin Flowerday wrote: > While attempting to locate all the memory in a program that wasn't > freed, I came across an odd behaviour. > > Using the following program: > > == START == > > static char * bar = 0; > static char * bar1 = 0; > > void do_stuff1() > { > bar = new char[1024]; > } > > void do_stuff() > { > bar1 = new char[1024]; > } > > int main( int argc, char ** argv ) > { > do_stuff(); > do_stuff1(); > } > > == END == > > (compiled with gcc 3.2.3 (debian unstable), using 'g++ main.cpp-o main' > > I get only 2 unreachable blocks, but both with the same stacktrace: > > 2048 bytes in 2 blocks are still reachable in loss record 1 of 1 > at 0x4015D573: __builtin_vec_new (vg_clientfuncs.c:161) > by 0x4015D5AE: operator new[](unsigned) (vg_clientfuncs.c:174) > by 0x8048450: do_stuff() (in /home/crispin/src/tmp/main) > by 0x8048470: main (in /home/crispin/src/tmp/main) > > Surely I should get 2 different stacktraces? I get the same with gcc 3.2.3. But with gcc 2.96 I get two stack traces. Hmm, not sure... N |