引用单元:System
DebugHook 与 ReportMemoryLeaksOnShutdown 都是 System 下的变量.
DebugHook: 程序中母体中运行时, 此值是 1; 独立运行时, 它是 0.
在程序的任何地方加上一句
ReportMemoryLeaksOnShutdown := True;
这样程序在关闭时可检测是否有内存泄漏.
如果这样使用: ReportMemoryLeaksOnShutdown := Boolean(DebugHook);
则程序只会在调试时报内存泄漏.
本文介绍了DebugHook和ReportMemoryLeaksOnShutdown两个变量的作用。DebugHook用于标识程序运行状态,而通过设置ReportMemoryLeaksOnShutdown为True可以在程序关闭时检测内存泄漏。特别地,将ReportMemoryLeaksOnShutdown设置为DebugHook的布尔值可以实现在调试模式下进行内存泄漏检测。
197

被折叠的 条评论
为什么被折叠?



