Share via


There’s a memory leak in my regular DLL, but my code looks fine. How can I find the memory leak?

OverviewHow Do IFAQDetailsSample

One possible cause of the memory leak is that MFC creates temporary objects that are used inside message handler functions. In regular DLLs, MFC does not automatically release memory allocated for these objects. For more information, see Solving Buffer Overwrites and Memory Leaks or the Knowledge Base article, “Cleaning Up Temporary MFC Objects in _USRDLL DLLs” (Q105286).

Note that the term USRDLL is no longer used in the Visual C++ documentation. A regular DLL that is statically linked to MFC has the same characteristics as the former USRDLL. The advice in the Knowledge Base article also applies to regular DLLs that are dynamically linked to MFC. The information in the above Knowledge Base article applies to both regular DLLs that statically link to MFC and regular DLLs that dynamically link to MFC.

Feature Only in Professional and Enterprise Editions   Static linking to MFC is supported only in Visual C++ Professional and Enterprise Editions. For more information, see .