- 论坛徽章:
- 0
|
用valgrind检查内存泄漏, 如下:
2,448 bytes in 17 blocks are possibly lost in loss record 34 of 37
==12744== at 0x4023492: calloc (in /usr/lib/valgrind/x86-linux/vgpreload_memcheck.so)
==12744== by 0x4010D38: (within /lib/ld-2.8.so)
==12744== by 0x4010DFB: _dl_allocate_tls (in /lib/ld-2.8.so)
==12744== by 0x40409D9: pthread_create@@GLIBC_2.1 (in /lib/libpthread-2.8.so)
==12744== by 0x804CF0C: GSignalTransfer<sigslot::multi_threaded_local>::GSignalTransfer() (sigTransfer.h:31)
==12744== by 0x804A5D5: CNetInter::CNetInter() (NetInter.cpp:4)
==12744== by 0x8049CF4: TestServer::TestServer() (testServer.cpp:
==12744== by 0x8049B85: main (testServer.cpp:47)
sigTransfer.h : 31行..如下..
GSignalTransfer()
28 {
29 ///创建线程并设置为分离状态
30 pthread_t pid;
31 int nRet = pthread_create(&pid, NULL, threadFun, this);
32 if(0 == nRet)
33 {
34 nRet = pthread_detach(pid);
35 if(0 != nRet)
36 {
37 assert(0);
38 }
39 }
40 else
41 {
42 assert(0);
43 }
44
45 ///初始化锁
46 pthread_mutex_init(&mutex , NULL);
47 }
请问为什么会报pthread_create又内存泄漏啊, 多谢.. |
|