c++/6246: gcc generates code that memleaks

clemens@thf.ath.cx clemens@thf.ath.cx
Wed Apr 10 03:36:00 GMT 2002


>Number:         6246
>Category:       c++
>Synopsis:       gcc generates code that memleaks
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Apr 10 03:36:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     thf
>Release:        2.0.95
>Organization:
>Environment:
linux 2.4.17 glibc 2.2.4 dual celeron@433MHz
>Description:
testprogramm leaks 100bytes on each iteration depending on the  
location of "strstream str" declaration.
>How-To-Repeat:
#include <strstream>
#include <string>

#include <unistd.h>

static string *buf = NULL;

int
main(int argc, char **argv) {
// strstream str;

   while (1) {
      strstream str;

      buf = new string();
      str << 1;
      *buf += str.str();
      sleep(1);
      delete (buf);
   }
   return (0);
}
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-prs mailing list