[英]Cannot detect memory leaks in DLLs statically attached to C++ program
I have a host program that implicitly (with libs and their DLLs) loads DLLs. 我有一个主机程序,该程序隐式地(带有库及其DLL)加载DLL。 When I make a memory leak on purpose, in my host program, the
CrtDbg*
functions detect the leak. 当我故意使内存泄漏时,在我的宿主程序中,
CrtDbg*
函数会检测到泄漏。 When I on purpose make a memory leak in one of the DLLs the leak is not detected. 当我故意使其中一个DLL发生内存泄漏时,未检测到泄漏。
Note: in my host, I activate the _CrtDumpMemoryLeaks
function after the main function has terminated. 注意:在主机中,我在主要功能终止后激活
_CrtDumpMemoryLeaks
功能。
More than likely your DLLs are statically linking to the CRT. 您的DLL更有可能静态链接到CRT。 (or they are a retail build, but your EXE is a debug build).
(或者它们是零售版本,但您的EXE是调试版本)。 Either way, you have more than one heap.
无论哪种方式,您都有多个堆。 When you call _CrtDeumpMemoryLeaks, it can only track the unreleased memory allocations for the binary that calls is made from.
调用_CrtDeumpMemoryLeaks时,它只能跟踪进行调用的二进制文件的未释放内存分配。 You have two options.
您有两个选择。
OR 要么
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.