如何获取实例已经泄漏内存的定制结构的名称? [英] How to obtain the names of custom-made structures whose instances have leaked memory?

查看:143
本文介绍了如何获取实例已经泄漏内存的定制结构的名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理一个解析器,它将通过一个FASTMM4内存泄漏报告,并将所有相关数据存储在一个定制的结构/类中。我使用 VirtualTreeView 来显示每个已泄露的情况下,在树中的一个节点类。 -
请注意,第一个节点说不明。这是因为FASTMM调用方法 AClass 来确定天气是否是一类。当它找到自定义结构时,它将它们标记为未知,这不会使我的报告分析器非常有效,因为大多数内存泄漏来自这些自定义结构和记录。



问题:有没有办法使用DebugInfo或其他一些工具,如 JVCL 收集这些调试符号,并将其内存地址与内存泄漏报告文件中的内存地址进行比较。我希望我的树停止显示UNKNOWN并显示这些自定义结构的名称。
我是Delphi编程的新手,甚至更新来处理内存泄漏,所以任何帮助意味着很多!

解决方案

可能扩展RTTI(Delphi 2010一个较新的)可以用于创建一个类型字典,它只保存typeinfo指针和所有非类类型的名称。



可以使用条件定义来启用此功能,以避免在正常操作中的开销。


I am working a on parser which will go through a FASTMM4 memory leak report and store all relevant data in a custom-made structure/class. I use VirtualTreeView to display each class that has leaked instances as a node in the tree. The tree - Notice that the FIRST node says unknown. This is because FASTMM calls a method AClass to determine weather it is a class or not. When it finds custom structures, it marks them as unknown, which doesn't make my report analyzer very effective since most memory leaks come from these custom structures and records.

Question: Is there a way to use DebugInfo or some other tool like JVCL to gather those debug symbols and compare their memory addresses to the ones found in the memory-leak-report-file? I would like my tree to stop showing UNKNOWN and show the names of these custom structures. I am new to Delphi programming, and even newer to tackling memory leaks, so any help would mean much!

解决方案

Maybe extended RTTI (Delphi 2010 an newer) can be used to create a type dictionary, which only holds typeinfo pointers and names of all "non-class" types.

This feature could be enabled with a conditional define to avoid its overhead in normal operation.

这篇关于如何获取实例已经泄漏内存的定制结构的名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆