누군가가 부스트 스레드 라이브러리 유출 여부를 알려 줄 수 있습니까? 그것은 나에게 보인다 : 구글은 내가하고있는 boost thread와 pthread 모두로 컴파일해야한다고 말했고 버전 1.40에서는이 문제가 수정되었지만 여전히 누수가있다. 이 컴파일 잘되지만 누수가 감지됩니다 것을 유의하십시오. 아직 http://antonym.org/2009/05/threading-with-boost---part-i-creating-threads.html 같은 문제 : Valgrind의와부스트 스레드 누설 C++
#include <boost/thread.hpp>
#include <boost/date_time.hpp>
void t1(){}
int main(void){
boost::thread th1(t1);
th1.join();
return 1;
}
은 내가 또한 다음 웹 사이트에 나와있는 코드로 시도
HEAP SUMMARY:
==8209== in use at exit: 8 bytes in 1 blocks
==8209== total heap usage: 5 allocs, 4 frees, 388 bytes allocated
==8209==
==8209== 8 bytes in 1 blocks are still reachable in loss record 1 of 1
==8209== at 0x4024F20: malloc (vg_replace_malloc.c:236)
==8209== by 0x4038CCB: boost::detail::get_once_per_thread_epoch() (in /usr/local/lib/libboost_thread.so.1.42.0)
==8209== by 0x40329D4: ??? (in /usr/local/lib/libboost_thread.so.1.42.0)
==8209== by 0x4032B26: boost::detail::get_current_thread_data() (in /usr/local/lib/libboost_thread.so.1.42.0)
==8209== by 0x4033F32: boost::thread::join() (in /usr/local/lib/libboost_thread.so.1.42.0)
==8209== by 0x804E7C3: main (testboost.cpp)
==8209==
==8209== LEAK SUMMARY:
==8209== definitely lost: 0 bytes in 0 blocks
==8209== indirectly lost: 0 bytes in 0 blocks
==8209== possibly lost: 0 bytes in 0 blocks
==8209== still reachable: 8 bytes in 1 blocks
==8209== suppressed: 0 bytes in 0 blocks
다음과 같은 출력을 얻을.
부스트 소스에서 src/pthread/Once.cpp를보십시오. 그것이 누설되지 않는다는 것은 꽤 분명하다. (단지 pthread 라이브러리 함수의 정의를 보라.) – Mankarse
부스트 대신에'std :: thread'를 사용하면 코드가 나를 위해 실행되지 않습니다. 'std :: system_error' 예외로 종료됩니다. –
위의 링크에서 코드를 시도하면 valgrind에서 누수가 가장 잘 보일 것입니다. –