How to obtain the names of custom-made structures whose instances have leaked memory?

て烟熏妆下的殇ゞ 提交于 2019-12-21 03:32:31

问题


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!


回答1:


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.



来源:https://stackoverflow.com/questions/12539319/how-to-obtain-the-names-of-custom-made-structures-whose-instances-have-leaked-me

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!