请教高手:使用AfxBeginThread创建线程,为什么在线程退出时会有内存泄漏?
我做了一个多线程的程序,结果线程退出时总是会出现内存泄露的问题,请各位高手指教:
经过跟踪发现:
_endthreadex(nExitCode); -》ExitThread(retcode);
在ExitThread时出现内存泄漏, 编译器提示如下:(VC7,windowsXP)
线程 '_threadstartex' (0xd0c) 已退出,返回值为 0 (0x0)。
aaa.DLL Terminating!
Detected memory leaks!
Dumping objects ->
{134} normal block at 0x00676A48, 84 bytes long.
Data: < cB qe qe qe > 20 63 42 00 E8 71 65 00 EE 71 65 00 EF 71 65 00
thrdcore.cpp(311) : {125} client block at 0x00676570, subtype c0, 68 bytes long.
a CWinThread object at $00676570, 68 bytes long
{124} normal block at 0x006764E8, 72 bytes long.
Data: <@bB > 40 62 42 00 00 00 00 00 01 00 00 00 01 00 00 00
Object dump complete.
线程 'Win32 线程' (0xa34) 已退出,返回值为 0 (0x0)。