This is the mail archive of the
cygwin-apps@cygwin.com
mailing list for the Cygwin project.
Re: String and std::string
- From: "William A. Hoffman" <billlist at nycap dot rr dot com>
- To: Cygwin Apps <cygwin-apps at cygwin dot com>
- Date: Fri, 21 Mar 2003 08:36:30 -0500
- Subject: Re: String and std::string
- References: <1048251339.1007.22.camel@localhost>
I think you are confusing strstream with string.
With strstream if you call .str(), you must call
delete on the string, or call freeze(0). I have never
seen a problem with g++ and string .c_str() leaking memory.
-Bill
At 08:08 AM 3/21/2003, Pavel Tsekov wrote:
>On 21 Mar 2003, Robert Collins wrote:
>
>> this may well. Look in the g++ library for freeze() (again, IIRC). The
>> thing I saw when I was reading the source, was that the internal buffer
>> was not delete[]'d once it was handed out via c_str(). That was with the
>> libstc++ for gcc 2.95 as well. I've just checked the g++ 3
>> implementation, and it's different to what I recall from before...
>
>gcc 2.95.x has many problems in its standard c++ library
>implementation. I remeber seeing some implementations returning the
>internal pointer directly. I had many problem with iostreams with gcc
>2.95.x - I real nightmare.