20

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!

programstinator
  • 1,354
  • 3
  • 12
  • 31
  • 2
    http://jvcl.delphi-jedi.org/ http://www.lischke-online.de/index.php/controls/virtual-treeview @TLama thanks:) – programstinator Sep 21 '12 at 23:28
  • 1
    Couldn't that be the [`AppendClassNameToBuffer`](http://fastmm.svn.sourceforge.net/viewvc/fastmm/FastMM4.pas?revision=64&view=markup) function ? It's just a wild guess, I've never worked with FastMM internals, so don't take it seriously. – TLama Sep 22 '12 at 00:14
  • Exactly. That's the one. I'd rather not tinker with FastMM itself, though.. – programstinator Sep 22 '12 at 00:30
  • This is just a wild guess. FastMM comes with a bunch of settings. Maybe there is/are settings that expose UNKNOWN to something more meaningful? – Hendra Sep 22 '12 at 02:29
  • Are you building your app with enough debug info? – David Heffernan Sep 22 '12 at 08:11
  • 1
    This tool seems cool. Will you make it opensource ? – Jlouro Sep 22 '12 at 08:50
  • 1
    The tool will be open source.. As soon as I fix up a few bugs, I'll post the link to the code. @Hendra Unfortunately, no. The above mentioned function [AppendClassNameToBuffer](http://fastmm.svn.sourceforge.net/viewvc/fastmm/FastMM4.pas?revision=64&view=markup) is not that smart, I'm afraid. – programstinator Sep 22 '12 at 12:35
  • 1
    It's too late when `AppendClassNameBuffer` is called, it expects a class, and if there's no class it's passed nil.   AFAICT, the title and question asks very different things. I think the question in the title would require modifying fastmm sources. – Sertac Akyuz Sep 22 '12 at 14:02
  • 2
    @SertacAkyuz - you are right, I will edit the title, because I will have a better chance at using other tools in conjunction with FMM, rather than messing with FMM internals. – programstinator Sep 22 '12 at 17:12

1 Answers1

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.

mjn
  • 36,362
  • 28
  • 176
  • 378