A regular DLL linked statically to MFC library causes memory leak

Our platform is on WinCE 6.

In our main thread, we uses LoadLibrary to load a regular DLL, which is statically linked to MFC library. After loading the library, we go into an infinite loop to create a thread, wait for the thread termination, and create again. We can tell that the system memory become lower and lower if we run this app long time.

By googling, we found a MS article in below link mentioned a regular DLL will have memory leak if it's linked to MFC library, no matter by static or dynamic link.

http://msdn.microsoft.com/en-us/library/w6kc8ba3.aspx

So we modify our regular DLL to not link to MFC library, the memory leak is gone!

留言

熱門文章