c++/2517: -O2 compilation appears to cause a memory leak when a string is added to a char[]
knuteson@fnal.gov
knuteson@fnal.gov
Mon Apr 9 08:56:00 GMT 2001
>Number: 2517
>Category: c++
>Synopsis: -O2 compilation appears to cause a memory leak when a string is added to a char[]
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Apr 09 08:56:02 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Bruce Knuteson
>Release: unknown-1.0
>Organization:
>Environment:
mips-sgi-irix6.5
>Description:
-O2 compilation appears to cause a memory leak when a string is added to a char[]
>How-To-Repeat:
Compile the following with 'g++ -O2':
#include <string>
using namespace std;
int main()
{
string s1="hi",s2;
while(true)
s2=s1+" there.";
return(0);
}
and run while viewing memory usage using top.
The memory used quickly increases without bound.
>Fix:
I wish I knew . . .
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-bugs
mailing list