您的位置:程序门 -> vc/mfc -> 进程/线程/dll



detected memory leaks!


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


detected memory leaks![已结贴,结贴人:alunlee]
发表于:2007-10-04 17:16:55 楼主
我在主线程中创建了两个子线程,调试的时候在ide的输出窗口中老是这样:
the   thread   0x8f0   has   exited   with   code   0   (0x0).
the   thread   0xaf8   has   exited   with   code   0   (0x0).
the   thread   0x82c   has   exited   with   code   0   (0x0).
the   thread   0xfd0   has   exited   with   code   0   (0x0).
the   thread   0x250   has   exited   with   code   0   (0x0).
detected   memory   leaks!
dumping   objects   ->
thrdcore.cpp(166)   :   {520}   client   block   at   0x00e66598,   subtype   0,   108   bytes   long.
a   cwinthread   object   at   $00e66598,   108   bytes   long
object   dump   complete.


哪位有好点的调试方法?
发表于:2007-10-04 17:25:241楼 得分:0
内存泄漏,而且已经指明了位置thrdcore.cpp(166).
如果这样你都调试不了.谁也帮不了你.
发表于:2007-10-04 18:52:262楼 得分:0
这就是166行:
cwinthread*   pthread   =   debug_new   cwinthread(pfnthreadproc,   pparam);
我实在看不出有什么问题?
发表于:2007-10-04 22:03:173楼 得分:5
你delete了吗?
发表于:2007-10-06 17:55:174楼 得分:5
下载一个   boundscheck   能告诉你是哪条指令造成的内存泄露,它可以检测到vc检测不到的内存泄露
发表于:2007-10-08 18:04:275楼 得分:10
原因是这些thread是被你强制关闭得而不是它自动结束得

当线程自己结束时,它会释放一堆东西,包括线程自己,如果你不让线程自己结束,相关内存就泄漏了。

cwinthread对象一般不需要手工释放,因为cwinthread::m_bautodelete缺省被设置为true,这样线程结束时会释放它


快速检索

最新资讯
热门点击