Hi Thomas,

I suspect it's misuse on your part.  Remember, with istrstream and
ostrstream, after you call str(), you must either delete the pointer you
get back, or call freeze(false) to tell the stream to unfreeze the memory:

   ostrstream msg;

   msg << "foo" << '\0';

   cout << msg.str();

   msg.freeze(false);

or

   ostrstream msg;

   msg << "foo" << '\0';

   const char* const  data = msg.str();

   cout << data;

   delete [] data;


Dave



                                                                                
                                                                
                      [EMAIL PROTECTED]                                         
                                                         
                      oftware.com                      To:      
[email protected]                                                    
                                                       cc:      (bcc: David N 
Bertoni/Cambridge/IBM)                                            
                      11/26/2002 11:57 AM              Subject: Memory leaks in 
STD library                                                     
                                                                                
                                                                






We are slowly replacing every usage of istrstream, ostrstream in our code
by our own classes as it seems, at least on windows 2000 using VC++ 6.0,
that there are very big memory leaks in those classes.


Is it something that anyone else experienced as well or is something
surprising and we are may be doing something wrong somewhere?


The memory leaks we are experiencing are big enough to make our application
crash after processing 20000 XML documents (~10 to 40 Kb per document) on a
P4 machine with 512 Meg of memory.


Tomas



Reply via email to