我想将内存泄漏检测添加到我们的自动化单元测试中。 ReportMemoryLeaksOnShutdown 将检测任何内存泄漏。最大的问题是它将结果打印到模式对话框中,该对话框必须由用户手动关闭。这在构建服务器上运行的自动化单元测试中不起作用。
有没有办法将 ReportMemoryLeaksOnShutdown 的输出重定向到其他地方?比如将信息打印到文件中?
文档说:
the Memory Manager will scan the memory pool when it shuts down and report all unregistered memory leaks in a message dialog.
我使用的是Delphi 2010
最佳答案
下载FastMM4的完整版本来自sourceforge。您可以将其配置为写入 FastMM4Options.inc 中的日志文件;只需查看下载中的自述文件和常见问题解答文件即可了解详细信息。具体来说,请查找有关 FullDebugMode
和 LogErrorsToFile
的信息,以及常见问题解答自述文件中的第三或第四个问题。
关于delphi - 将结果从 ReportMemoryLeaksOnShutdown 重定向到日志文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5399395/