we have been investigating memory leaks in our app.
So far we have always used FastMM4 for this. We have FastMM4 configured so that leaks are written to a log file.
Then I remembered that madExcept can also report leaks so I decided to give it a shot.
Using the madExcept Leak Report is way nicer and comfortable than using raw FastMM4 I must say
To test, I added a Memory Leak to our App.
I added the leak to the method MatClipperPolygon.TClipperPolygon.Clip.
madExcept does detect the leak, which is just great!
However there is a difference in the callstack when compared to the callstack listing that I get from FastMM4.
I added the exception to Core.bpl which is used by our App.exe.
Below is an extract from the FastMM4 log file, it points to the line where the memory leak ocurred. Very useful.
Code: Select all
--------------------------------2016/11/17 16:36:36--------------------------------
A memory block has been leaked. The size is: 100
This block was allocated by thread 0x3F14, and the stack trace (return addresses) at the time was:
5005A186 [System][@GetMem]
5005F5DF [System][TObject.NewInstance]
5005FE86 [System][@ClassCreate]
5015AB3A [System][Classes.TStringList]
47F0533 [MatClipperPolygon.pas][MatClipperPolygon][MatClipperPolygon.TClipperPolygon.Clip][248]
47F0543 [MatClipperPolygon.pas][MatClipperPolygon][MatClipperPolygon.TClipperPolygon.Clip][251]
5BEE1E6 [CAMAutoTextLocator.pas][CAMAutoTextLocator][CAMAutoTextLocator.TAutoTextLocator.CropSurfaceToInkJetExtents][647]
5BEFFC0 [CAMAutoTextLocator.pas][CAMAutoTextLocator][CAMAutoTextLocator.TAutoTextLocator.LocateAutoTextOnFrameSide][1207]
5BEFB55 [CAMAutoTextLocator.pas][CAMAutoTextLocator][CAMAutoTextLocator.TAutoTextLocator.LocateAutoText][1116]
5DE2A73 [ApmMachineService.pas][ApmMachineService][ApmMachineService.TMachineService.LocateAutoTextOperationWithinPart][1015]
54467DB [BvPart.pas][BvPart][BvPart.TPart.UpdateAutoText][5139]
The block is currently used for an object of class: TStringList
You will notice that the callstack is missing info from Core.bpl, which is where the memory leak ocurred.
It is picking up other bpl's along the way though.
Any idea why this happens. From what I read madExcept relies on FastMM4 for detecting memory leaks.
It would be great if the callstack retrieved by madExcept included the function where the memory leak orginated.
Thanks!