public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: libstdc++/6594: strstreambuf leaks 16 bytes - gcc 3.0.x
@ 2002-08-02 13:51 bkoz
0 siblings, 0 replies; 6+ messages in thread
From: bkoz @ 2002-08-02 13:51 UTC (permalink / raw)
To: bkoz, edh, gcc-bugs, gcc-prs
Synopsis: strstreambuf leaks 16 bytes - gcc 3.0.x
State-Changed-From-To: closed->open
State-Changed-By: bkoz
State-Changed-When: Fri Aug 2 13:51:50 2002
State-Changed-Why:
Reverted.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6594
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: libstdc++/6594: strstreambuf leaks 16 bytes - gcc 3.0.x
@ 2003-01-07 16:24 bkoz
0 siblings, 0 replies; 6+ messages in thread
From: bkoz @ 2003-01-07 16:24 UTC (permalink / raw)
To: bkoz, edh, gcc-bugs, gcc-prs
Synopsis: strstreambuf leaks 16 bytes - gcc 3.0.x
State-Changed-From-To: open->closed
State-Changed-By: bkoz
State-Changed-When: Tue Jan 7 08:24:02 2003
State-Changed-Why:
THis is fixed in 3.2 and later
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6594
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: libstdc++/6594: strstreambuf leaks 16 bytes - gcc 3.0.x
@ 2002-05-17 3:09 bkoz
0 siblings, 0 replies; 6+ messages in thread
From: bkoz @ 2002-05-17 3:09 UTC (permalink / raw)
To: bkoz, edh, gcc-bugs, gcc-prs
Synopsis: strstreambuf leaks 16 bytes - gcc 3.0.x
State-Changed-From-To: feedback->closed
State-Changed-By: bkoz
State-Changed-When: Fri May 17 03:09:08 2002
State-Changed-Why:
Fixed.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6594
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: libstdc++/6594: strstreambuf leaks 16 bytes - gcc 3.0.x
@ 2002-05-15 17:36 Ed Hourigan
0 siblings, 0 replies; 6+ messages in thread
From: Ed Hourigan @ 2002-05-15 17:36 UTC (permalink / raw)
To: bkoz; +Cc: gcc-prs
The following reply was made to PR libstdc++/6594; it has been noted by GNATS.
From: "Ed Hourigan" <edh@twcny.rr.com>
To: <bkoz@gcc.gnu.org>, <bkoz@gcc.gnu.org>, <edh@twcny.rr.com>,
<gcc-bugs@gcc.gnu.org>, <gcc-prs@gcc.gnu.org>, <nobody@gcc.gnu.org>,
<gcc-gnats@gcc.gnu.org>
Cc:
Subject: RE: libstdc++/6594: strstreambuf leaks 16 bytes - gcc 3.0.x
Date: Wed, 15 May 2002 20:26:12 -0400
Yes, I am aware that it is deprecated. However, it is still used in quite a
lot of places.
Eventually, I will replace it with strinstream. But during this
'transition' period I still need to use it.
I will try your patch.
-----Original Message-----
From: bkoz@gcc.gnu.org [mailto:bkoz@gcc.gnu.org]
Sent: Wednesday, May 15, 2002 8:58 AM
To: bkoz@gcc.gnu.org; edh@twcny.rr.com; gcc-bugs@gcc.gnu.org;
gcc-prs@gcc.gnu.org; nobody@gcc.gnu.org
Subject: Re: libstdc++/6594: strstreambuf leaks 16 bytes - gcc 3.0.x
Synopsis: strstreambuf leaks 16 bytes - gcc 3.0.x
Responsible-Changed-From-To: unassigned->bkoz
Responsible-Changed-By: bkoz
Responsible-Changed-When: Wed May 15 05:57:30 2002
Responsible-Changed-Why:
Mine.
State-Changed-From-To: open->feedback
State-Changed-By: bkoz
State-Changed-When: Wed May 15 05:57:30 2002
State-Changed-Why:
So it does....
strstream.cc: 69 has
strstreambuf::strstreambuf(streamsize initial_capacity)
: _Base(),
_M_alloc_fun(0), _M_free_fun(0),
_M_dynamic(true), _M_frozen(false), _M_constant(false)
{
streamsize n = max(initial_capacity, streamsize(16));
char* buf = _M_alloc(n);
if (buf) {
setp(buf, buf + n);
setg(buf, buf, buf);
}
Wow.
Are you aware that this class has been deprecated by std::stringstream?
You might consider using it instead.
However, it turns out that the bug is pretty easy to fix. You might try
this, and let me know how it goes.
2002-05-15 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/6594
* src/strstream.cc (strstreambuf): Fix leak.
The patch is here:
http://gcc.gnu.org/ml/gcc-patches/2002-05/msg01204.html
best,
benjamin
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&p
r=6594
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: libstdc++/6594: strstreambuf leaks 16 bytes - gcc 3.0.x
@ 2002-05-15 5:57 bkoz
0 siblings, 0 replies; 6+ messages in thread
From: bkoz @ 2002-05-15 5:57 UTC (permalink / raw)
To: bkoz, edh, gcc-bugs, gcc-prs, nobody
Synopsis: strstreambuf leaks 16 bytes - gcc 3.0.x
Responsible-Changed-From-To: unassigned->bkoz
Responsible-Changed-By: bkoz
Responsible-Changed-When: Wed May 15 05:57:30 2002
Responsible-Changed-Why:
Mine.
State-Changed-From-To: open->feedback
State-Changed-By: bkoz
State-Changed-When: Wed May 15 05:57:30 2002
State-Changed-Why:
So it does....
strstream.cc: 69 has
strstreambuf::strstreambuf(streamsize initial_capacity)
: _Base(),
_M_alloc_fun(0), _M_free_fun(0),
_M_dynamic(true), _M_frozen(false), _M_constant(false)
{
streamsize n = max(initial_capacity, streamsize(16));
char* buf = _M_alloc(n);
if (buf) {
setp(buf, buf + n);
setg(buf, buf, buf);
}
Wow.
Are you aware that this class has been deprecated by std::stringstream? You might consider using it instead.
However, it turns out that the bug is pretty easy to fix. You might try this, and let me know how it goes.
2002-05-15 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/6594
* src/strstream.cc (strstreambuf): Fix leak.
The patch is here:
http://gcc.gnu.org/ml/gcc-patches/2002-05/msg01204.html
best,
benjamin
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6594
^ permalink raw reply [flat|nested] 6+ messages in thread
* libstdc++/6594: strstreambuf leaks 16 bytes - gcc 3.0.x
@ 2002-05-07 7:56 edh
0 siblings, 0 replies; 6+ messages in thread
From: edh @ 2002-05-07 7:56 UTC (permalink / raw)
To: gcc-gnats
>Number: 6594
>Category: libstdc++
>Synopsis: strstreambuf leaks 16 bytes - gcc 3.0.x
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue May 07 07:56:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Ed Hourigan
>Release: gcc 3.0.4
>Organization:
>Environment:
Red Hat Linux 7.2 on x86 processor
>Description:
The default constructor for strstreambuf allocates a
buffer of 16 bytes. If you assign a user supplied
buffer by calling setp(...), then the 16 byte buffer is
not released and the pointer is lost.
I have verified this leak using the linux tool 'memprof'
Sample code:
( I am deriving a class from strstreambuf so I can control
where the output stream goes )
class MyStreambuf : public strstreambuf
{
public:
MyStreambuf()
{
setp( _buffer, _buffer, _buffer+BUFSIZE ); // leak
here!
...
}
private:
static const int BUFSIZE=256;
char _buffer[BUFSIZE];
}
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2003-01-07 16:24 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-02 13:51 libstdc++/6594: strstreambuf leaks 16 bytes - gcc 3.0.x bkoz
-- strict thread matches above, loose matches on Subject: below --
2003-01-07 16:24 bkoz
2002-05-17 3:09 bkoz
2002-05-15 17:36 Ed Hourigan
2002-05-15 5:57 bkoz
2002-05-07 7:56 edh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).