valgrind 와 pthread_create의 관계에 대한 질문 입니다.

tjdalse의 이미지

새로운 프로젝트를 맏게 되어 일을 하던 도중 SE로 부터 메모리 누수가 있는거 같으니 확인해 달라는 요청을 받았습니다.

근데 아직 구조도 잘 모르고 전임자는 퇴사 했는데 참 막막 하네요..

각설 하고,

때문에 valgrind를 돌려 보았는데요,

프로그램 실행 중에 valgrind가 동작을 멈추고 빠져 나오는 현상이 있습니다.

이럴수도 있나요?

원인이 무엇인가 해서 하나 하나 찍어가며 종료 되는 포인트를 찾아 보니 다음 코드에서 종료 되고 있네요.

=================================================================
pthread_attr_t threadAttr;
pthread_attr_init(&threadAttr);
pthread_attr_setdetachstate(&threadAttr, PTHREAD_CREATE_DETACHED);
pthread_attr_setstacksize(&threadAttr, m_stackSize);

if(0 != pthread_create(&m_threadId, &threadAttr, threadLoop, this))
bRet = false;
==================================================================

valgrind는 아래 와 같이 찍고 죽었습니다.
=================================================================
Thread 297: status = VgTs_WaitSys
==27610== at 0x392900AB00: pthread_cond_timedwait@@GLIBC_2.3.2 (in /lib64/libpthread-2.5.so)
==27610== by 0x61816F: AxSync::Wait(unsigned) (AxSync.cpp:45)
==27610== by 0x6033B5: AxMemberWorker::Main() (AxWorkerPool.cpp:127)
==27610== by 0x602E97: AxThread::threadLoop(void*) (AxThread.cpp:78)
==27610== by 0x3929006366: start_thread (in /lib64/libpthread-2.5.so)
==27610== by 0x391ECD30AC: clone (in /lib64/libc-2.5.so_tb)

Thread 298: status = VgTs_WaitSys
==27610== at 0x392900AB00: pthread_cond_timedwait@@GLIBC_2.3.2 (in /lib64/libpthread-2.5.so)
==27610== by 0x61816F: AxSync::Wait(unsigned) (AxSync.cpp:45)
==27610== by 0x6033B5: AxMemberWorker::Main() (AxWorkerPool.cpp:127)
==27610== by 0x602E97: AxThread::threadLoop(void*) (AxThread.cpp:78)
==27610== by 0x3929006366: start_thread (in /lib64/libpthread-2.5.so)
==27610== by 0x391ECD30AC: clone (in /lib64/libc-2.5.so_tb)

Thread 299: status = VgTs_WaitSys
==27610== at 0x392900AB00: pthread_cond_timedwait@@GLIBC_2.3.2 (in /lib64/libpthread-2.5.so)
==27610== by 0x61816F: AxSync::Wait(unsigned) (AxSync.cpp:45)
==27610== by 0x6033B5: AxMemberWorker::Main() (AxWorkerPool.cpp:127)
==27610== by 0x602E97: AxThread::threadLoop(void*) (AxThread.cpp:78)
==27610== by 0x3929006366: start_thread (in /lib64/libpthread-2.5.so)
==27610== by 0x391ECD30AC: clone (in /lib64/libc-2.5.so_tb)

Note: see also the FAQ.txt in the source distribution.
It contains workarounds to several common problems.

If that doesn't help, please report this bug to: www.valgrind.org

In the bug report, send all the above text, the valgrind
version, and what Linux distro you are using. Thanks.
==================================================================

그럼 많은 의견 부탁 드립니다..

댓글 달기

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
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.