有人能告诉我是否提升线程库泄漏.在我看来它确实如此:谷歌说我应该使用boost线程和pthread进行编译我正在做的和版本1.40这个问题已经修复但我仍然会泄漏.请注意,这将编译正常,但检测到泄漏.
#include <boost/thread.hpp>
#include <boost/date_time.hpp>
void t1(){}
int main(void){
boost::thread th1(t1);
th1.join();
return 1;
}
Run Code Online (Sandbox Code Playgroud)
使用Valgrind,我得到以下输出
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 …Run Code Online (Sandbox Code Playgroud)