public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/12094] New: runtime mem leak in executable, using ostringstream
@ 2003-08-28 15:24 j dot beyer at web dot de
2003-08-28 15:27 ` [Bug libstdc++/12094] " pinskia at gcc dot gnu dot org
0 siblings, 1 reply; 2+ messages in thread
From: j dot beyer at web dot de @ 2003-08-28 15:24 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2512 bytes --]
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12094
Summary: runtime mem leak in executable, using ostringstream
Product: gcc
Version: 3.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: j dot beyer at web dot de
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
I think, I found a mem leak - maybe I am wrong.
This simple source:
------------------------------------
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
void f() {
ostringstream s;
s << "huhu";
cout << s.str() << endl;
}
int main(int argc, char* argv[]) {
int runs = argc==2?atoi(argv[1]):1;
for(int i=0;i<runs; ++i) {
f();
}
}
------------------------------------
compile: g++ main.cpp -g·
valgrind: valgrind -v --leak-check=yes --show-reachable=yes --num-callers=15 ./a
.out 1000
where 1000 is the number of loops you want to try.
compiles and links to a binary that - according to
valgrind - leaks some mem if the loop runs at least
once, thus calls f(). It is not relevant how often
the loop runs. I could reproduce it with any gcc up
to gcc-3.1.1 (have not yet tried CVS-HEAD).
Here is the relvant valgrind output for
0 runs
==26314== LEAK SUMMARY:
==26314== definitely lost: 16 bytes in 1 blocks.
==26314== possibly lost: 0 bytes in 0 blocks.
==26314== still reachable: 64 bytes in 1 blocks.
==26314== suppressed: 0 bytes in 0 blocks.
1 run
==26342== LEAK SUMMARY:
==26342== definitely lost: 16 bytes in 1 blocks.
==26342== possibly lost: 0 bytes in 0 blocks.
==26342== still reachable: 1024 bytes in 2 blocks.
==26342== suppressed: 0 bytes in 0 blocks.
1000 runs
==27255== LEAK SUMMARY:
==27255== definitely lost: 16 bytes in 1 blocks.
==27255== possibly lost: 0 bytes in 0 blocks.
==27255== still reachable: 1024 bytes in 2 blocks.
==27255== suppressed: 0 bytes in 0 blocks.
Since calling f() several times leaks always the same
amount of memory, I am not sure if this has to do with
some static memory that is allocated once (like for the
locale stuff).
Questions:
* could anybody else reproduce this
* is it a leak that may hurt?
Joerg Beyer
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug libstdc++/12094] runtime mem leak in executable, using ostringstream
2003-08-28 15:24 [Bug c++/12094] New: runtime mem leak in executable, using ostringstream j dot beyer at web dot de
@ 2003-08-28 15:27 ` pinskia at gcc dot gnu dot org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-08-28 15:27 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12094
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Component|c++ |libstdc++
Resolution| |INVALID
------- Additional Comments From pinskia at gcc dot gnu dot org 2003-08-28 15:27 -------
This is a FAQ: <http://gcc.gnu.org/onlinedocs/libstdc++/faq/index.html#4_4_leak>, sorry it is a
non-bug.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-08-28 15:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-28 15:24 [Bug c++/12094] New: runtime mem leak in executable, using ostringstream j dot beyer at web dot de
2003-08-28 15:27 ` [Bug libstdc++/12094] " pinskia at gcc dot gnu dot org
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).