public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/27931]  New: valgrind reports memleak when std::ios:sync_with_stdio(false)
@ 2006-06-07 14:52 gcc-bugzilla at gcc dot gnu dot org
  2006-06-07 15:58 ` [Bug libstdc++/27931] " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: gcc-bugzilla at gcc dot gnu dot org @ 2006-06-07 14:52 UTC (permalink / raw)
  To: gcc-bugs


A memory leak happens when  std::ios::sync_with_stdio(false);
valgrind:
...
==13644==
==13644== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 17 from 1)
==13644== malloc/free: in use at exit: 122,880 bytes in 6 blocks.
==13644== malloc/free: 6 allocs, 0 frees, 122,880 bytes allocated.
==13644== For counts of detected errors, rerun with: -v
==13644== searching for pointers to 6 not-freed blocks.
==13644== checked 96,388 bytes.
==13644==
==13644== 24,576 bytes in 3 blocks are still reachable in loss record 1 of 2
==13644==    at 0x401BCC9: operator new[](unsigned) (vg_replace_malloc.c:197)
==13644==    by 0x4090D7B: std::basic_filebuf<char, std::char_traits<char>
>::_M_allocate_internal_buffer() (in 
/usr/lib/libstdc++.so.6.0.8)
==13644==    by 0x4098805: (within /usr/lib/libstdc++.so.6.0.8)
==13644==    by 0x40862D6: std::ios_base::sync_with_stdio(bool) (in
/usr/lib/libstdc++.so.6.0.8)
==13644==    by 0x8048712: main (in ...)
==13644==
==13644==
==13644== 98,304 bytes in 3 blocks are still reachable in loss record 2 of 2
==13644==    at 0x401BCC9: operator new[](unsigned) (vg_replace_malloc.c:197)
==13644==    by 0x4090D2E: std::basic_filebuf<wchar_t,
std::char_traits<wchar_t> >::_M_allocate_internal_buffer() (in 
/usr/lib/libstdc++.so.6.0.8)
==13644==    by 0x40981F5: (within /usr/lib/libstdc++.so.6.0.8)
==13644==    by 0x40863B4: std::ios_base::sync_with_stdio(bool) (in
/usr/lib/libstdc++.so.6.0.8)
==13644==    by 0x8048712: main (in ...)
==13644==
==13644== LEAK SUMMARY:
==13644==    definitely lost: 0 bytes in 0 blocks.
==13644==      possibly lost: 0 bytes in 0 blocks.
==13644==    still reachable: 122,880 bytes in 6 blocks.
==13644==         suppressed: 0 bytes in 0 blocks.

Environment:
System: Linux penelope 2.6.15-1-k7 #2 Mon Mar 6 15:42:39 UTC 2006 i686
GNU/Linux
Architecture: i686


host: i486-pc-linux-gnu
build: i486-pc-linux-gnu
target: i486-pc-linux-gnu
configured with: ../src/configure -v
--enable-languages=c,c++,java,fortran,objc,obj-c++,ada,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu
--enable-libstdcxx-debug --enable-java-awt=gtk --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-4.1-1.4.2.0/jre --enable-mpfr
--with-tune=i686 --enable-checking=release i486-linux-gnu

How-To-Repeat:
// run with valgrind --leak-check=full --show-reachable=yes 
#include <iostream>
int 
main(void)
{
  std::ios::sync_with_stdio(false);
  std::cout << "testing" << std::endl;
  return 0;
}


------- Comment #1 from mirko dot maischberger at gmail dot com  2006-06-07 14:40 -------
Fix:
std::ios::sync_with_stdio(true);


-- 
           Summary: valgrind reports memleak when
                    std::ios:sync_with_stdio(false)
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mirko dot maischberger at gmail dot com
 GCC build triplet: i486-pc-linux-gnu
  GCC host triplet: i486-pc-linux-gnu
GCC target triplet: i486-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27931


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libstdc++/27931] valgrind reports memleak when std::ios:sync_with_stdio(false)
  2006-06-07 14:52 [Bug libstdc++/27931] New: valgrind reports memleak when std::ios:sync_with_stdio(false) gcc-bugzilla at gcc dot gnu dot org
@ 2006-06-07 15:58 ` pinskia at gcc dot gnu dot org
  2006-06-07 17:52 ` mirko dot maischberger at gmail dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-06-07 15:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2006-06-07 15:53 -------
Can you read:
http://gcc.gnu.org/onlinedocs/libstdc++/debug.html#mem

And try with those options?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27931


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libstdc++/27931] valgrind reports memleak when std::ios:sync_with_stdio(false)
  2006-06-07 14:52 [Bug libstdc++/27931] New: valgrind reports memleak when std::ios:sync_with_stdio(false) gcc-bugzilla at gcc dot gnu dot org
  2006-06-07 15:58 ` [Bug libstdc++/27931] " pinskia at gcc dot gnu dot org
@ 2006-06-07 17:52 ` mirko dot maischberger at gmail dot com
  2006-06-07 18:03 ` mirko dot maischberger at gmail dot com
  2006-06-08  1:04 ` pcarlini at suse dot de
  3 siblings, 0 replies; 5+ messages in thread
From: mirko dot maischberger at gmail dot com @ 2006-06-07 17:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from mirko dot maischberger at gmail dot com  2006-06-07 17:43 -------
Subject: Re:  valgrind reports memleak when std::ios:sync_with_stdio(false)

#include <iostream>
#include <cstdlib>

extern "C" void __libc_freeres(void);

int main(void)
{
  atexit(__libc_freeres);
  std::ios::sync_with_stdio(false);
  std::cout << "ten bytes" << std::endl;
  return 0;
}

tesi@penelope:~$ g++-4.1 sync_with_stdio.cc
tesi@penelope:~$   valgrind -v --num-callers=20 --leak-check=yes
--leak-resolution=high --show-reachable=yes ./a.out
==20104== Memcheck, a memory error detector.
==20104== Copyright (C) 2002-2005, and GNU GPL'd, by Julian Seward et al.
==20104== Using LibVEX rev 1575, a library for dynamic binary translation.
==20104== Copyright (C) 2004-2005, and GNU GPL'd, by OpenWorks LLP.
==20104== Using valgrind-3.1.1-Debian, a dynamic binary
instrumentation framework.
==20104== Copyright (C) 2000-2005, and GNU GPL'd, by Julian Seward et al.
==20104==
--20104-- Command line
--20104--    ./a.out
--20104-- Startup, with flags:
--20104--    --suppressions=/usr/lib/valgrind/debian-libc6-dbg.supp
--20104--    -v
--20104--    --num-callers=20
--20104--    --leak-check=yes
--20104--    --leak-resolution=high
--20104--    --show-reachable=yes
--20104-- Contents of /proc/version:
--20104--   Linux version 2.6.15-1-k7 (Debian 2.6.15-8)
(waldi@debian.org) (gcc version 4.0.3 20060212 (prerelease) (Debian
4.0.2-9)) #2 Mon Mar 6 15:42:39 UTC 2006
--20104-- Arch and subarch: X86, x86-sse1
--20104-- Valgrind library directory: /usr/lib/valgrind
--20104-- Reading syms from /lib/ld-2.3.6.so (0x4000000)
--20104-- Reading debug info from /lib/ld-2.3.6.so...
--20104-- ... CRC mismatch (computed A0828FFB wanted BF5D33FD)
--20104-- Reading debug info from /usr/lib/debug/lib/ld-2.3.6.so...
--20104--    object doesn't have a symbol table
--20104-- Reading syms from /home/tesi/a.out (0x8048000)
--20104-- Reading syms from /usr/lib/valgrind/x86-linux/memcheck (0xA000000)
--20104--    object doesn't have a dynamic symbol table
--20104-- Reading suppressions file: /usr/lib/valgrind/debian-libc6-dbg.supp
--20104-- Reading suppressions file: /usr/lib/valgrind/default.supp
--20104-- Reading syms from
/usr/lib/valgrind/x86-linux/vgpreload_core.so (0x4018000)
--20104-- Reading syms from
/usr/lib/valgrind/x86-linux/vgpreload_memcheck.so (0x401A000)
--20104-- Reading syms from /usr/lib/libstdc++.so.6.0.8 (0x403C000)
--20104--    object doesn't have a symbol table
--20104-- Reading syms from /usr/lib/debug/libm-2.3.6.so (0x411E000)
--20104-- Reading syms from /lib/libgcc_s.so.1 (0x4144000)
--20104--    object doesn't have a symbol table
--20104-- Reading syms from /usr/lib/debug/libc-2.3.6.so (0x414F000)
--20104-- REDIR: 0x41BAAB0 (rindex) redirected to 0x401CE90 (rindex)
--20104-- REDIR: 0x41BB6D0 (memset) redirected to 0x401D440 (memset)
--20104-- REDIR: 0x41BA680 (strlen) redirected to 0x401D0B0 (strlen)
--20104-- REDIR: 0x40EF6B0 (operator new[](unsigned)) redirected to
0x401BC40 (operator new[](unsigned))
--20104-- REDIR: 0x41BBBF0 (memcpy) redirected to 0x401D540 (memcpy)
ten bytes
--20104-- REDIR: 0x41B4900 (free) redirected to 0x401BFC6 (free)
==20104==
==20104== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 17 from 1)
--20104--
--20104-- supp:   17 Debian libc6 stripped dynamic linker
==20104== malloc/free: in use at exit: 122,880 bytes in 6 blocks.
==20104== malloc/free: 6 allocs, 0 frees, 122,880 bytes allocated.
==20104==
==20104== searching for pointers to 6 not-freed blocks.
==20104== checked 96,388 bytes.
==20104==
==20104== 8,192 bytes in 1 blocks are still reachable in loss record 1 of 6
==20104==    at 0x401BCC9: operator new[](unsigned) (vg_replace_malloc.c:197)
==20104==    by 0x4090D7B: std::basic_filebuf<char,
std::char_traits<char> >::_M_allocate_internal_buffer() (in
/usr/lib/libstdc++.so.6.0.8)
==20104==    by 0x4098805: (within /usr/lib/libstdc++.so.6.0.8)
==20104==    by 0x408632E: std::ios_base::sync_with_stdio(bool) (in
/usr/lib/libstdc++.so.6.0.8)
==20104==    by 0x804877E: main (in /home/tesi/a.out)
==20104==
==20104==
==20104== 8,192 bytes in 1 blocks are still reachable in loss record 2 of 6
==20104==    at 0x401BCC9: operator new[](unsigned) (vg_replace_malloc.c:197)
==20104==    by 0x4090D7B: std::basic_filebuf<char,
std::char_traits<char> >::_M_allocate_internal_buffer() (in
/usr/lib/libstdc++.so.6.0.8)
==20104==    by 0x4098805: (within /usr/lib/libstdc++.so.6.0.8)
==20104==    by 0x4086302: std::ios_base::sync_with_stdio(bool) (in
/usr/lib/libstdc++.so.6.0.8)
==20104==    by 0x804877E: main (in /home/tesi/a.out)
==20104==
==20104==
==20104== 8,192 bytes in 1 blocks are still reachable in loss record 3 of 6
==20104==    at 0x401BCC9: operator new[](unsigned) (vg_replace_malloc.c:197)
==20104==    by 0x4090D7B: std::basic_filebuf<char,
std::char_traits<char> >::_M_allocate_internal_buffer() (in
/usr/lib/libstdc++.so.6.0.8)
==20104==    by 0x4098805: (within /usr/lib/libstdc++.so.6.0.8)
==20104==    by 0x40862D6: std::ios_base::sync_with_stdio(bool) (in
/usr/lib/libstdc++.so.6.0.8)
==20104==    by 0x804877E: main (in /home/tesi/a.out)
==20104==
==20104==
==20104== 32,768 bytes in 1 blocks are still reachable in loss record 4 of 6
==20104==    at 0x401BCC9: operator new[](unsigned) (vg_replace_malloc.c:197)
==20104==    by 0x4090D2E: std::basic_filebuf<wchar_t,
std::char_traits<wchar_t> >::_M_allocate_internal_buffer() (in
/usr/lib/libstdc++.so.6.0.8)
==20104==    by 0x40981F5: (within /usr/lib/libstdc++.so.6.0.8)
==20104==    by 0x408640C: std::ios_base::sync_with_stdio(bool) (in
/usr/lib/libstdc++.so.6.0.8)
==20104==    by 0x804877E: main (in /home/tesi/a.out)
==20104==
==20104==
==20104== 32,768 bytes in 1 blocks are still reachable in loss record 5 of 6
==20104==    at 0x401BCC9: operator new[](unsigned) (vg_replace_malloc.c:197)
==20104==    by 0x4090D2E: std::basic_filebuf<wchar_t,
std::char_traits<wchar_t> >::_M_allocate_internal_buffer() (in
/usr/lib/libstdc++.so.6.0.8)
==20104==    by 0x40981F5: (within /usr/lib/libstdc++.so.6.0.8)
==20104==    by 0x40863E0: std::ios_base::sync_with_stdio(bool) (in
/usr/lib/libstdc++.so.6.0.8)
==20104==    by 0x804877E: main (in /home/tesi/a.out)
==20104==
==20104==
==20104== 32,768 bytes in 1 blocks are still reachable in loss record 6 of 6
==20104==    at 0x401BCC9: operator new[](unsigned) (vg_replace_malloc.c:197)
==20104==    by 0x4090D2E: std::basic_filebuf<wchar_t,
std::char_traits<wchar_t> >::_M_allocate_internal_buffer() (in
/usr/lib/libstdc++.so.6.0.8)
==20104==    by 0x40981F5: (within /usr/lib/libstdc++.so.6.0.8)
==20104==    by 0x40863B4: std::ios_base::sync_with_stdio(bool) (in
/usr/lib/libstdc++.so.6.0.8)
==20104==    by 0x804877E: main (in /home/tesi/a.out)
==20104==
==20104== LEAK SUMMARY:
==20104==    definitely lost: 0 bytes in 0 blocks.
==20104==      possibly lost: 0 bytes in 0 blocks.
==20104==    still reachable: 122,880 bytes in 6 blocks.
==20104==         suppressed: 0 bytes in 0 blocks.
--20104--  memcheck: sanity checks: 6 cheap, 1 expensive
--20104--  memcheck: auxmaps: 0 auxmap entries (0k, 0M) in use
--20104--  memcheck: auxmaps: 0 searches, 0 comparisons
--20104--  memcheck: secondaries: 11 issued (704k, 0M)
--20104--  memcheck: secondaries: 33 accessible and distinguished (2112k, 2M)
--20104--     tt/tc: 5,236 tt lookups requiring 5,329 probes
--20104--     tt/tc: 5,236 fast-cache updates, 2 flushes
--20104-- translate: new        2,614 (57,683 -> 908,750; ratio 157:10) [0 scs]
--20104-- translate: dumped     0 (0 -> ??)
--20104-- translate: discarded  0 (0 -> ??)
--20104-- scheduler: 320,402 jumps (bb entries).
--20104-- scheduler: 6/2,728 major/minor sched events.
--20104--    sanity: 7 cheap, 1 expensive checks.
--20104--    exectx: 30,011 lists, 12 contexts (avg 0 per list)
--20104--    exectx: 23 searches, 11 full compares (478 per 1000)
--20104--    exectx: 0 cmp2, 38 cmp4, 15 cmpAll


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27931


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libstdc++/27931] valgrind reports memleak when std::ios:sync_with_stdio(false)
  2006-06-07 14:52 [Bug libstdc++/27931] New: valgrind reports memleak when std::ios:sync_with_stdio(false) gcc-bugzilla at gcc dot gnu dot org
  2006-06-07 15:58 ` [Bug libstdc++/27931] " pinskia at gcc dot gnu dot org
  2006-06-07 17:52 ` mirko dot maischberger at gmail dot com
@ 2006-06-07 18:03 ` mirko dot maischberger at gmail dot com
  2006-06-08  1:04 ` pcarlini at suse dot de
  3 siblings, 0 replies; 5+ messages in thread
From: mirko dot maischberger at gmail dot com @ 2006-06-07 18:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from mirko dot maischberger at gmail dot com  2006-06-07 17:51 -------
Subject: Re:  valgrind reports memleak when std::ios:sync_with_stdio(false)

And even with GLIBCXX_FORCE_NEW


#include <iostream>
#include <cstdlib>

extern "C" void __libc_freeres(void);

int main(void)
{
  atexit(__libc_freeres);
  std::ios::sync_with_stdio(false);
  std::cout << "ten bytes" << std::endl;
  return 0;
}

tesi@penelope:~$ g++-4.1 -DGLIBCXX_FORCE_NEW sync_with_stdio.cc
tesi@penelope:~$ GLIBCXX_FORCE_NEW=1  valgrind -v --num-callers=20
--leak-check=yes --leak-resolution=high --show-reachable=yes ./a.out

==20579== Memcheck, a memory error detector.
==20579== Copyright (C) 2002-2005, and GNU GPL'd, by Julian Seward et al.
==20579== Using LibVEX rev 1575, a library for dynamic binary translation.
==20579== Copyright (C) 2004-2005, and GNU GPL'd, by OpenWorks LLP.
==20579== Using valgrind-3.1.1-Debian, a dynamic binary
instrumentation framework.
==20579== Copyright (C) 2000-2005, and GNU GPL'd, by Julian Seward et al.
==20579==
--20579-- Command line
--20579--    ./a.out
--20579-- Startup, with flags:
--20579--    --suppressions=/usr/lib/valgrind/debian-libc6-dbg.supp
--20579--    -v
--20579--    --num-callers=20
--20579--    --leak-check=yes
--20579--    --leak-resolution=high
--20579--    --show-reachable=yes
--20579-- Contents of /proc/version:
--20579--   Linux version 2.6.15-1-k7 (Debian 2.6.15-8)
(waldi@debian.org) (gcc version 4.0.3 20060212 (prerelease) (Debian
4.0.2-9)) #2 Mon Mar 6 15:42:39 UTC 2006
--20579-- Arch and subarch: X86, x86-sse1
--20579-- Valgrind library directory: /usr/lib/valgrind
--20579-- Reading syms from /lib/ld-2.3.6.so (0x4000000)
--20579-- Reading debug info from /lib/ld-2.3.6.so...
--20579-- ... CRC mismatch (computed A0828FFB wanted BF5D33FD)
--20579-- Reading debug info from /usr/lib/debug/lib/ld-2.3.6.so...
--20579--    object doesn't have a symbol table
--20579-- Reading syms from /home/tesi/a.out (0x8048000)
--20579-- Reading syms from /usr/lib/valgrind/x86-linux/memcheck (0xA000000)
--20579--    object doesn't have a dynamic symbol table
--20579-- Reading suppressions file: /usr/lib/valgrind/debian-libc6-dbg.supp
--20579-- Reading suppressions file: /usr/lib/valgrind/default.supp
--20579-- Reading syms from
/usr/lib/valgrind/x86-linux/vgpreload_core.so (0x4018000)
--20579-- Reading syms from
/usr/lib/valgrind/x86-linux/vgpreload_memcheck.so (0x401A000)
--20579-- Reading syms from /usr/lib/libstdc++.so.6.0.8 (0x403C000)
--20579--    object doesn't have a symbol table
--20579-- Reading syms from /usr/lib/debug/libm-2.3.6.so (0x411E000)
--20579-- Reading syms from /lib/libgcc_s.so.1 (0x4144000)
--20579--    object doesn't have a symbol table
--20579-- Reading syms from /usr/lib/debug/libc-2.3.6.so (0x414F000)
--20579-- REDIR: 0x41BAAB0 (rindex) redirected to 0x401CE90 (rindex)
--20579-- REDIR: 0x41BB6D0 (memset) redirected to 0x401D440 (memset)
--20579-- REDIR: 0x41BA680 (strlen) redirected to 0x401D0B0 (strlen)
--20579-- REDIR: 0x40EF6B0 (operator new[](unsigned)) redirected to
0x401BC40 (operator new[](unsigned))
--20579-- REDIR: 0x41BBBF0 (memcpy) redirected to 0x401D540 (memcpy)
ten bytes
--20579-- REDIR: 0x41B4900 (free) redirected to 0x401BFC6 (free)
==20579==
==20579== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 17 from 1)
--20579--
--20579-- supp:   17 Debian libc6 stripped dynamic linker
==20579== malloc/free: in use at exit: 122,880 bytes in 6 blocks.
==20579== malloc/free: 6 allocs, 0 frees, 122,880 bytes allocated.
==20579==
==20579== searching for pointers to 6 not-freed blocks.
==20579== checked 96,388 bytes.
==20579==
==20579== 8,192 bytes in 1 blocks are still reachable in loss record 1 of 6
==20579==    at 0x401BCC9: operator new[](unsigned) (vg_replace_malloc.c:197)
==20579==    by 0x4090D7B: std::basic_filebuf<char,
std::char_traits<char> >::_M_allocate_internal_buffer() (in
/usr/lib/libstdc++.so.6.0.8)
==20579==    by 0x4098805: (within /usr/lib/libstdc++.so.6.0.8)
==20579==    by 0x408632E: std::ios_base::sync_with_stdio(bool) (in
/usr/lib/libstdc++.so.6.0.8)
==20579==    by 0x804877E: main (in /home/tesi/a.out)
==20579==
==20579==
==20579== 8,192 bytes in 1 blocks are still reachable in loss record 2 of 6
==20579==    at 0x401BCC9: operator new[](unsigned) (vg_replace_malloc.c:197)
==20579==    by 0x4090D7B: std::basic_filebuf<char,
std::char_traits<char> >::_M_allocate_internal_buffer() (in
/usr/lib/libstdc++.so.6.0.8)
==20579==    by 0x4098805: (within /usr/lib/libstdc++.so.6.0.8)
==20579==    by 0x4086302: std::ios_base::sync_with_stdio(bool) (in
/usr/lib/libstdc++.so.6.0.8)
==20579==    by 0x804877E: main (in /home/tesi/a.out)
==20579==
==20579==
==20579== 8,192 bytes in 1 blocks are still reachable in loss record 3 of 6
==20579==    at 0x401BCC9: operator new[](unsigned) (vg_replace_malloc.c:197)
==20579==    by 0x4090D7B: std::basic_filebuf<char,
std::char_traits<char> >::_M_allocate_internal_buffer() (in
/usr/lib/libstdc++.so.6.0.8)
==20579==    by 0x4098805: (within /usr/lib/libstdc++.so.6.0.8)
==20579==    by 0x40862D6: std::ios_base::sync_with_stdio(bool) (in
/usr/lib/libstdc++.so.6.0.8)
==20579==    by 0x804877E: main (in /home/tesi/a.out)
==20579==
==20579==
==20579== 32,768 bytes in 1 blocks are still reachable in loss record 4 of 6
==20579==    at 0x401BCC9: operator new[](unsigned) (vg_replace_malloc.c:197)
==20579==    by 0x4090D2E: std::basic_filebuf<wchar_t,
std::char_traits<wchar_t> >::_M_allocate_internal_buffer() (in
/usr/lib/libstdc++.so.6.0.8)
==20579==    by 0x40981F5: (within /usr/lib/libstdc++.so.6.0.8)
==20579==    by 0x408640C: std::ios_base::sync_with_stdio(bool) (in
/usr/lib/libstdc++.so.6.0.8)
==20579==    by 0x804877E: main (in /home/tesi/a.out)
==20579==
==20579==
==20579== 32,768 bytes in 1 blocks are still reachable in loss record 5 of 6
==20579==    at 0x401BCC9: operator new[](unsigned) (vg_replace_malloc.c:197)
==20579==    by 0x4090D2E: std::basic_filebuf<wchar_t,
std::char_traits<wchar_t> >::_M_allocate_internal_buffer() (in
/usr/lib/libstdc++.so.6.0.8)
==20579==    by 0x40981F5: (within /usr/lib/libstdc++.so.6.0.8)
==20579==    by 0x40863E0: std::ios_base::sync_with_stdio(bool) (in
/usr/lib/libstdc++.so.6.0.8)
==20579==    by 0x804877E: main (in /home/tesi/a.out)
==20579==
==20579==
==20579== 32,768 bytes in 1 blocks are still reachable in loss record 6 of 6
==20579==    at 0x401BCC9: operator new[](unsigned) (vg_replace_malloc.c:197)
==20579==    by 0x4090D2E: std::basic_filebuf<wchar_t,
std::char_traits<wchar_t> >::_M_allocate_internal_buffer() (in
/usr/lib/libstdc++.so.6.0.8)
==20579==    by 0x40981F5: (within /usr/lib/libstdc++.so.6.0.8)
==20579==    by 0x40863B4: std::ios_base::sync_with_stdio(bool) (in
/usr/lib/libstdc++.so.6.0.8)
==20579==    by 0x804877E: main (in /home/tesi/a.out)
==20579==
==20579== LEAK SUMMARY:
==20579==    definitely lost: 0 bytes in 0 blocks.
==20579==      possibly lost: 0 bytes in 0 blocks.
==20579==    still reachable: 122,880 bytes in 6 blocks.
==20579==         suppressed: 0 bytes in 0 blocks.
--20579--  memcheck: sanity checks: 6 cheap, 1 expensive
--20579--  memcheck: auxmaps: 0 auxmap entries (0k, 0M) in use
--20579--  memcheck: auxmaps: 0 searches, 0 comparisons
--20579--  memcheck: secondaries: 11 issued (704k, 0M)
--20579--  memcheck: secondaries: 33 accessible and distinguished (2112k, 2M)
--20579--     tt/tc: 5,236 tt lookups requiring 5,329 probes
--20579--     tt/tc: 5,236 fast-cache updates, 2 flushes
--20579-- translate: new        2,614 (57,683 -> 908,750; ratio 157:10) [0 scs]
--20579-- translate: dumped     0 (0 -> ??)
--20579-- translate: discarded  0 (0 -> ??)
--20579-- scheduler: 320,402 jumps (bb entries).
--20579-- scheduler: 6/2,728 major/minor sched events.
--20579--    sanity: 7 cheap, 1 expensive checks.
--20579--    exectx: 30,011 lists, 12 contexts (avg 0 per list)
--20579--    exectx: 23 searches, 11 full compares (478 per 1000)
--20579--    exectx: 0 cmp2, 38 cmp4, 15 cmpAll


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27931


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libstdc++/27931] valgrind reports memleak when std::ios:sync_with_stdio(false)
  2006-06-07 14:52 [Bug libstdc++/27931] New: valgrind reports memleak when std::ios:sync_with_stdio(false) gcc-bugzilla at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2006-06-07 18:03 ` mirko dot maischberger at gmail dot com
@ 2006-06-08  1:04 ` pcarlini at suse dot de
  3 siblings, 0 replies; 5+ messages in thread
From: pcarlini at suse dot de @ 2006-06-08  1:04 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 751 bytes --]



------- Comment #5 from pcarlini at suse dot de  2006-06-08 00:54 -------
This behavior started with this patch:

  http://gcc.gnu.org/ml/libstdc++/2003-04/msg00427.html

when Pétur pointed out that, according to 27.3, p2, the standard streams are
*never* destroyed.

The ""leak"" appears only with sync_with_stdio(false) simply because the
synced, default, buffer doesn't do any dynamic memory allocation.


-- 

pcarlini at suse dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27931


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-06-08  0:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-07 14:52 [Bug libstdc++/27931] New: valgrind reports memleak when std::ios:sync_with_stdio(false) gcc-bugzilla at gcc dot gnu dot org
2006-06-07 15:58 ` [Bug libstdc++/27931] " pinskia at gcc dot gnu dot org
2006-06-07 17:52 ` mirko dot maischberger at gmail dot com
2006-06-07 18:03 ` mirko dot maischberger at gmail dot com
2006-06-08  1:04 ` pcarlini at suse dot de

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).