Problem with delete[] in class destructor

Nicolas Wack nwack@iua.upf.es
Tue Mar 22 10:02:00 GMT 2005


Hi all!

I have a little problem, and I thought maybe someone could help me out 
before I go crazy!!
Here's a simple file that allocates some amount of memory (roughly 
300MB), sleeps for 5 secs, deallocates it and sleeps for 15 seconds.

I know for sure that the program goes through all the destructors, 
however nothing gets freed...
I can also reproduce this behavior (bug?) by replacing the Test class 
with std::vector, for instance.
Also, calling v[i]->destroy() instead of deleting the object doesn't do 
anything neither...

Can somebody tell me what's wrong? Is that a problem with gcc or the 
libc or libstdc++?

Thanks in advance!

Nicolas.

My versions are:

debian unstable
linux 2.6.10
g++ 3.3.5 (debian version)
Configured with: ../src/configure -v 
--enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr 
--mandir=/usr/share/man --infodir=/usr/share/info 
--with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared 
--enable-__cxa_atexit --with-system-zlib --enable-nls 
--without-included-gettext --enable-clocale=gnu --enable-debug 
--enable-java-gc=boehm --enable-java-awt=xlib --enable-objc-gc i486-linux
Thread model: posix
gcc version 3.3.5 (Debian 1:3.3.5-12)
glibc6 2.3.2.ds1-20
libstdc++ 1:3.3.5-12
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mem.cpp
Type: text/x-c++src
Size: 506 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20050322/c2fe27ca/attachment.bin>


More information about the Gcc-help mailing list