- 论坛徽章:
- 0
|
stl 有内存泄漏吗?(高人指点一下)
不知道你的产生内存泄漏的结论是如何的出来的.能不能给提供个数据看一下.
下面使用valgrind检测的结果:
- [root@localhost prog]# valgrind -v memoryLeak
- ==2776== Memcheck, a memory error detector.
- ==2776== Copyright (C) 2002-2005, and GNU GPL'd, by Julian Seward et al.
- ==2776== Using LibVEX rev 1313, a library for dynamic binary translation.
- ==2776== Copyright (C) 2004-2005, and GNU GPL'd, by OpenWorks LLP.
- ==2776== Using valgrind-3.0.0, a dynamic binary instrumentation framework.
- ==2776== Copyright (C) 2000-2005, and GNU GPL'd, by Julian Seward et al.
- --2776-- Valgrind library directory: /usr/lib/valgrind
- --2776-- Command line
- --2776-- memoryLeak
- --2776-- Startup, with flags:
- --2776-- -v
- --2776-- Contents of /proc/version:
- --2776-- Linux version 2.6.13-1.1535_FC5 (bhcompile@bugs.build.redhat.com) (gcc version 4.0.1 20050831 (Red Hat 4.0.1-12)) #1 Sun Sep 4 02:20:28 EDT 2005
- --2776-- Reading syms from /root/prog/memoryLeak (0x8048000)
- --2776-- Reading syms from /lib/ld-2.3.90.so (0x1B8E4000)
- --2776-- Reading syms from /usr/lib/valgrind/stage2 (0xB0000000)
- --2776-- Reading suppressions file: /usr/lib/valgrind/default.supp
- ==2776==
- --2776-- Reading syms from /usr/lib/valgrind/vg_preload_core.so (0x1B8FF000)
- --2776-- Reading syms from /usr/lib/valgrind/vgpreload_memcheck.so (0x1B902000)
- --2776-- REDIR: 0x1B8F8DB0 (index) redirected to 0x1B905084 (index)
- --2776-- Reading syms from /lib/libsafe.so.2.0.16c (0x1B908000)
- --2776-- object doesn't have a symbol table
- --2776-- Reading syms from /usr/lib/libstdc++.so.6.0.6 (0x1B934000)
- --2776-- object doesn't have a symbol table
- --2776-- Reading syms from /lib/libm-2.3.90.so (0x1BA1D000)
- --2776-- Reading syms from /lib/libgcc_s-4.0.1-20050831.so.1 (0x1BA42000)
- --2776-- object doesn't have a symbol table
- --2776-- Reading syms from /lib/libc-2.3.90.so (0x1BA4C000)
- --2776-- Reading syms from /lib/libdl-2.3.90.so (0x1BB78000)
- --2776-- REDIR: 0x1BAB6D60 (rindex) redirected to 0x1B904F94 (rindex)
- --2776-- REDIR: 0x1B8E47F0 (_dl_sysinfo_int80) redirected to 0xB0022B03 (???)
- --2776-- REDIR: 0x1BAB1BFE (malloc) redirected to 0x1B903793 (malloc)
- --2776-- REDIR: 0x1BAAFDC8 (free) redirected to 0x1B9042B2 (free)
- --2776-- REDIR: 0x1BAB7BD0 (memset) redirected to 0x1B9053D8 (memset)
- --2776-- REDIR: 0x1B9E8890 (operator new(unsigned)) redirected to 0x1B903B2E (operator new(unsigned))
- --2776-- REDIR: 0x1BAB8030 (memcpy) redirected to 0x1B905490 (memcpy)
- --2776-- REDIR: 0x1B9E7308 (operator delete(void*)) redirected to 0x1B904546 (operator delete(void*))
- ==2776==
- ==2776== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 26 from 2)
- --2776--
- --2776-- supp: 3 index-not-intercepted-early-enough-HACK-1
- --2776-- supp: 23 dl_relocate_object
- ==2776== malloc/free: in use at exit: 40417236 bytes in 9920 blocks.
- ==2776== malloc/free: 9951 allocs, 31 frees, 57194292 bytes allocated.
- ==2776==
- ==2776== searching for pointers to 9920 not-freed blocks.
- ==2776== checked 40536016 bytes.
- ==2776==
- ==2776== LEAK SUMMARY:
- [color=red]==2776== definitely lost: 0 bytes in 0 blocks.
- ==2776== possibly lost: 0 bytes in 0 blocks.
- ==2776== still reachable: 40417236 bytes in 9920 blocks.
- ==2776== suppressed: 0 bytes in 0 blocks.
- ==2776== Reachable blocks (those to which a pointer was found) are not shown.[/color]
- ==2776== To see them, rerun with: --show-reachable=yes
- --2776-- memcheck: sanity checks: 5229 cheap, 210 expensive
- --2776-- memcheck: auxmaps: 0 auxmap entries (0k, 0M) in use
- --2776-- memcheck: auxmaps: 0 searches, 0 comparisons
- --2776-- memcheck: secondaries: 765 issued (48960k, 47M)
- --2776-- memcheck: secondaries: 33 accessible and distinguished (2112k, 2M)
- --2776-- tt/tc: 5649 tt lookups requiring 5788 probes
- --2776-- tt/tc: 5649 fast-cache updates, 3 flushes
- --2776-- translate: new 2706 (60927 ->; 991661; ratio 162:10) [0 scs]
- --2776-- translate: dumped 0 (0 ->; ??)
- --2776-- translate: discarded 2 (95 ->; ??)
- --2776-- scheduler: 261466397 jumps (bb entries).
- --2776-- scheduler: 5229/18233 major/minor sched events.
- --2776-- sanity: 5230 cheap, 210 expensive checks.
- --2776-- exectx: 4999 lists, 26 contexts (avg 0 per list)
- --2776-- exectx: 10008 searches, 9982 full compares (997 per 1000)
- --2776-- exectx: 0 cmp2, 81 cmp4, 0 cmpAll
复制代码 |
|