将ReportMemoryLeaksOnShutdown的结果重定向到日志文件

编程入门 行业动态 更新时间:2024-10-10 07:32:20
本文介绍了将ReportMemoryLeaksOnShutdown的结果重定向到日志文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我想为我们的自动化单元测试添加内存泄漏检测。 ReportMemoryLeaksOnShutdown会检测到任何内存泄漏。最大的问题是它将结果打印到一个模态对话框,必须由用户手动关闭。在构建服务器上运行的自动化Unit测试中,这不起作用。

有没有办法将ReportMemoryLeaksOnShutdown的输出重定向到别的地方?例如,将信息打印到文件中?

doco说:

内存管理器将在内存池关闭时扫描在消息对话框中报告所有未注册的内存泄漏 。

我正在使用Delphi 2010

解决方案

下载完整版本来自sourceforge的 FastMM4 。您可以将其配置为写入FastMM4Options.inc中的日志文件;只需在下载中查看自述文件和FAQ文件,了解详细信息。具体来说,查找有关 FullDebugMode 和 LogErrorsToFile 的信息,以及常见问题解答中的第三或第四个问题。

I want to add memory leak detection to our automated Unit tests. ReportMemoryLeaksOnShutdown will detect any memory leaks. The big problem is that it prints the results to a modal dialog box, which has to be closed manually by the user. This does not work in an automated Unit test running on a build server.

Is there any way to redirect the output from ReportMemoryLeaksOnShutdown to somewhere else? For example, print the information to a file?

The doco says:

the Memory Manager will scan the memory pool when it shuts down and report all unregistered memory leaks in a message dialog.

I am using Delphi 2010

解决方案

Download the full version of FastMM4 from sourceforge. You can configure it to write to a logfile in FastMM4Options.inc; just check the readme and FAQ files in the download for details. Specifically, look for information regarding FullDebugMode and LogErrorsToFile, and the third or fourth question in the FAQ readme.

更多推荐

将ReportMemoryLeaksOnShutdown的结果重定向到日志文件

本文发布于:2023-11-28 20:32:52,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1643859.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:重定向   文件   日志   ReportMemoryLeaksOnShutdown

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!