Reminder to Self:
{The class used to catch attempts to execute a virtual method of a freed object} TFreedObject = class public procedure GetVirtualMethodIndex; procedure VirtualMethodError; {$ifdef CatchUseOfFreedInterfaces} procedure InterfaceError; {$endif} end;
If you encounter the class TFreedObject
when doing a cast, then you’re working on a freed object and have FastMM4 enabled to detect that.
Source: [WayBack] FastMM4/FastMM4.pas at master · pleriche/FastMM4 · GitHub; FastMM4 – A memory manager for Delphi and C++ Builder with powerful debugging facilities
Note that if you want to see the underlying FastMM data for any TObject allocation, use this watch (where Self is the current instance):
PFullDebugBlockHeader(PByte(Self) - SizeOf(TFullDebugBlockHeader))^
You can also put a ,r
behind it to see the fields of this structure:
(Reserved1:nil; Reserved2:nil; AllocatedByRoutine:$41BF74; AllocationGroup:0; AllocationNumber:592682; AllocationStackTrace:(4224198, 4233131, 4235210, 11103806, 6552132, 131126, 6597961, 11106984, 4235210, 11107153, 11104090); AllocatedByThread:90428; FreedByThread:90428; FreeStackTrace:(4241541, 131126, 4235210, 11103806, 6552132, 131126, 6597961, 11106984, 4235210, 11107153, 11104090); UserSize:36; PreviouslyUsedByClass:132272; HeaderCheckSum:2673350594)
–jeroen