Linux Memory leak valgrind
Linux 에서 Thread 프로그래밍을 만들었습니다.
메모리 누수에 대해서 valgrind를 가지고 확인하였는데요
나오는 내용 보는 법을 잘 몰라서 문의 드립니다.
LEAK SUMMARY를 보면 문제가 있는 것 같은데요
어떤 부분이 문제인지...
Error는 없다고 나오는데 possible lost에 보면 뭐라고 나오는데요
이것도 메모리 누수를 지적하는 건가요?
==20231== Process terminating with default action of signal 2 (SIGINT)
==20231== at 0x32F2B6: (within /lib/libc-2.5.so)
==20231== by 0x804A7C9: main (in /home/ongreen/server/bin/ongreen_db)
--20231-- Discarding syms at 0x7D1C000-0x7D27000 in /lib/libnss_files-2.5.so due to munmap()
==20231==
==20231== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 20 from 1)
--20231--
--20231-- supp: 20 Fedora-Core-6-hack3-ld25
==20231== malloc/free: in use at exit: 1,328,311 bytes in 445 blocks.
==20231== malloc/free: 555 allocs, 110 frees, 1,499,194 bytes allocated.
==20231==
==20231== searching for pointers to 445 not-freed blocks.
==20231== checked 315,465,584 bytes.
==20231==
==20231== 335 bytes in 5 blocks are possibly lost in loss record 4 of 10
==20231== at 0x4005B65: operator new(unsigned) (vg_replace_malloc.c:163)
==20231== by 0x6460EA: std::string::_Rep::_S_create(unsigned, unsigned, std::allocator const&) (in /usr/lib/libstdc++.so.6.0.8)
==20231== by 0x646EE4: (within /usr/lib/libstdc++.so.6.0.8)
==20231== by 0x6470F6: std::string::string(char const*, std::allocator const&) (in /usr/lib/libstdc++.so.6.0.8)
==20231== by 0x804A688: main (in /home/ongreen/server/bin/ongreen_db)
==20231==
==20231==
==20231== 4,320 bytes in 30 blocks are possibly lost in loss record 7 of 10
==20231== at 0x40046FF: calloc (vg_replace_malloc.c:279)
==20231== by 0x290D49: _dl_allocate_tls (in /lib/ld-2.5.so)
==20231== by 0x418B92: pthread_create@@GLIBC_2.1 (in /lib/libpthread-2.5.so)
==20231== by 0x804A03A: init_thread() (in /home/ongreen/server/bin/ongreen_db)
==20231== by 0x804A1CA: main (in /home/ongreen/server/bin/ongreen_db)
==20231==
==20231== LEAK SUMMARY:
==20231== definitely lost: 0 bytes in 0 blocks.
==20231== possibly lost: 4,655 bytes in 35 blocks.
==20231== still reachable: 1,323,656 bytes in 410 blocks.
==20231== suppressed: 0 bytes in 0 blocks.
==20231== Reachable blocks (those to which a pointer was found) are not shown.
==20231== To see them, rerun with: --show-reachable=yes
--20231-- memcheck: sanity checks: 521 cheap, 21 expensive
--20231-- memcheck: auxmaps: 0 auxmap entries (0k, 0M) in use
--20231-- memcheck: auxmaps: 0 searches, 0 comparisons
--20231-- memcheck: SMs: n_issued = 76 (1216k, 1M)
--20231-- memcheck: SMs: n_deissued = 0 (0k, 0M)
--20231-- memcheck: SMs: max_noaccess = 65535 (1048560k, 1023M)
--20231-- memcheck: SMs: max_undefined = 0 (0k, 0M)
--20231-- memcheck: SMs: max_defined = 4829 (77264k, 75M)
--20231-- memcheck: SMs: max_non_DSM = 76 (1216k, 1M)
--20231-- memcheck: max sec V bit nodes: 1 (0k, 0M)
--20231-- memcheck: set_sec_vbits8 calls: 1 (new: 1, updates: 0)
--20231-- memcheck: max shadow mem size: 1520k, 1M
--20231-- translate: fast SP updates identified: 6,961 ( 89.3%)
--20231-- translate: generic_known SP updates identified: 506 ( 6.4%)
--20231-- translate: generic_unknown SP updates identified: 322 ( 4.1%)
--20231-- tt/tc: 13,806 tt lookups requiring 14,371 probes
--20231-- tt/tc: 13,806 fast-cache updates, 4 flushes
--20231-- transtab: new 5,427 (123,018 -> 2,015,166; ratio 163:10) [0 scs]
--20231-- transtab: dumped 0 (0 -> ??)
--20231-- transtab: discarded 126 (2,150 -> ??)
--20231-- scheduler: 36,273,830 jumps (bb entries).
--20231-- scheduler: 521/10,505 major/minor sched events.
--20231-- sanity: 522 cheap, 21 expensive checks.
--20231-- exectx: 30,011 lists, 86 contexts (avg 0 per list)
--20231-- exectx: 685 searches, 599 full compares (874 per 1000)
--20231-- exectx: 748 cmp2, 62 cmp4, 0 cmpAll
Killed
Thread로 동작중인 프로세스를 kill 시키면 정보가 나오는데요
kill 시켰을때 memory가 전부 자동 Free가 되는건 아닌가요?
댓글 달기