FastMM: I'm a newbie using this. Sadly, I've never used it and the output is a little scary on how many problems it finds. I've been breaking down the code into functional test units for FastMM, but it's slow going. I'm starting to think I'm missing some tricks.

FastMM: I'm a newbie using this. Sadly, I've never used it and the output is a little scary on how many problems it finds. I've been breaking down the code into functional test units for FastMM, but it's slow going. I'm starting to think I'm missing some tricks.

With some Googling, I found the following HOWTO that one of our friends from WideOrbit made. The link appears to be dead, as video.codegear.com doesn't seem to respond. (See below for details).

Anyone have a good link for this or others for tricks on reading the output from FastMM? I understand it's call-stacks, that's the easy part, but I feel like I must be missing something.

Fighting Memory Leaks for Dummies
Francois Gaillard — WideOrbit, Inc.

http://video.codegear.com/CodeRageIIArchives/Day4/FrancoisGaillard_MemoryLeaks_English.zip

http://edn.embarcadero.com/article/37498
http://edn.embarcadero.com/article/37498

Comments

  1. The memory leak output isn't like a call stack; it's like a tree.  What you want is to find the roots.  These are usually the classes with the least amount of leaks.

    For example, if your program says it's leaking 1000 objects of type TMyObject, and 1 object of type TObjectList, your problem is almost certainly that you're leaking the list. Clear that up and it should fix the objects in the list. (Assuming the list owns the objects, of course.)

    Once you know what to look for, check the FastMM callstacks (you can do this by building with FullDebugMode enabled and making sure you build a full map file in your project's linker options) to find where the roots are leaking, and follow the Single Ownership Principle (http://tech.turbu-rpg.com/106/delphi-memory-management-made-simple) to determine how to free the object in question properly once you find where it's being allocated.

    ReplyDelete

Post a Comment