This is the mail archive of the mailing list for the GCC 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]

libstdc++/6594: strstreambuf leaks 16 bytes - gcc 3.0.x

>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
>Originator:     Ed Hourigan
>Release:        gcc 3.0.4
Red Hat Linux 7.2 on x86 processor
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 

       setp( _buffer, _buffer, _buffer+BUFSIZE );  // leak 


    static const int BUFSIZE=256;
    char _buffer[BUFSIZE];



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