i tried valgrind in combination with the GLIBCXX_FORCE_NEW option.
valgrind
says i have freed all the the heap blocks, but still the memory
occupied by the program
doesn't reduce after doing the free.
(i have increased the loop count from 10,000 to 100,000)
here is the output:

[EMAIL PROTECTED] temp]$ GLIBCXX_FORCE_NEW=1 valgrind ./test
==7249== Memcheck, a memory error detector.
==7249== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et
al.
==7249== Using LibVEX rev 1732, a library for dynamic binary
translation.
==7249== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
==7249== Using valgrind-3.2.3, a dynamic binary instrumentation
framework.
==7249== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et
al.
==7249== For more details, rerun with: -v
==7249==
OK!
==7249==
==7249== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 17 from
1)
==7249== malloc/free: in use at exit: 0 bytes in 0 blocks.
==7249== malloc/free: 200,000 allocs, 200,000 frees, 500,900,000 bytes
allocated.
==7249== For counts of detected errors, rerun with: -v
==7249== All heap blocks were freed -- no leaks are possible.


On Aug 27, 10:16 am, Bernd Strieder <[EMAIL PROTECTED]>
wrote:
> Hello,
>
>  [EMAIL PROTECTED] wrote:
> > I am using Mandriva Linux (2.6.17-14) with gnu g++ version 4.1.2. The
> > source code used to test is given below.
> > When i am run the program, it is properly freeing up the allocated
> > memory. When also including the
> > lines that are commented in the code, the "delete" is not freeing up
> > the memory used. I do not have
> > the problem when compiling under cygwin.  What can be done to fix
> > this?
>
> Read
>
> http://gcc.gnu.org/onlinedocs/libstdc++/20_util/allocator.html
>
> Read the docs of valgrind, then use valgrind. If the problem persists,
> come back.
>
> Bernd Strieder


_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to