Memory leak in sstream

Matej Urbas matej.urbas@guest.arnes.si
Thu Sep 15 21:39:00 GMT 2005


Hi

I've recently used the stringstream class in one of my projects in which 
I have predefined the global new operator (to search for any memory leaks).

When doing something like this:

stringstream* str = new stringstream;
str.put( 'c' );
delete str;

some memory is allocated by the stringstream class (when put is 
processed). However, after the delete call (in the third line), those 
memory allocations don't get deallocated by means of the global delete 
operator (even though they are created in this fashion) - it seems like 
the destructor doesn't do its job (right)...

Is this a memory leak, or is this only a design issue (is the data 
deallocated in an other way, an not with the delete operator)?

Please help me with that, please.

Best regards

Matej



More information about the Libstdc++ mailing list