Re: Class Size Creation Statistics



Hi Eric,

> To Pierre: I haven't investigated FastMM in this direction, but would that
> kind of stats be readily/easily available already in FastMM?

You can take a snapshot of the number of blocks allocated for every block
size. The function is called "GetMemoryManagerState":

procedure GetMemoryManagerState(var AMemoryManagerState:
TMemoryManagerState);

type
TSmallBlockTypeState = packed record
{The internal size of the block type}
InternalBlockSize: Cardinal;
{Useable block size: The number of non-reserved bytes inside the block.}
UseableBlockSize: Cardinal;
{The number of allocated blocks}
AllocatedBlockCount: Cardinal;
{The total address space reserved for this block type (both allocated
and
free blocks)}
ReservedAddressSpace: Cardinal;
end;
TSmallBlockTypeStates = array[0..NumSmallBlockTypes - 1] of
TSmallBlockTypeState;

TMemoryManagerState = packed record
{Small block type states}
SmallBlockTypeStates: TSmallBlockTypeStates;
{Medium block stats}
AllocatedMediumBlockCount: Cardinal;
TotalAllocatedMediumBlockSize: Cardinal;
ReservedMediumBlockAddressSpace: Cardinal;
{Large block stats}
AllocatedLargeBlockCount: Cardinal;
TotalAllocatedLargeBlockSize: Cardinal;
ReservedLargeBlockAddressSpace: Cardinal;
end;

Regards,
Pierre


.