Linux Memory leak valgrind

bueline의 이미지

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가 되는건 아닌가요?

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.