This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Memory leak in sstream


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]