Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does GetMemoryManagerState, ReservedAddressSpace do in Delphi?

Tags:

delphi

I have a code and It gives me some numbers. I don't know what do these numbers mean. I am curious, what these numbers mean. Thank you for your answer!

procedure usdmem(var stradd,stpadd:array of Integer);
var
st: TMemoryManagerState;
sb: TSmallBlockTypeState;
i:Integer;
begin
 GetMemoryManagerState(st);
 i:=0;
 for  sb in st.SmallBlockTypeStates do
 begin
   stradd[i]:=sb.ReservedAddressSpace;
   stpadd[i]:=stradd[i]+sb.UseableBlockSize*8;
   inc(i);
 end;
end;
//-----------------------------------
usdmem(stradd,stpadd);
for I := 0 to 10 do
begin
  Write(inttostr(stradd[I]));
  Write(' - ');
  WriteLn(inttostr(stpadd[I]));
end;
like image 778
Mandy Taylor Avatar asked Jan 29 '26 20:01

Mandy Taylor


1 Answers

The information can be found in the program documentation: TMemoryManagerState. And there's more information available in a number of topics index from Memory Management Index.

If you want to really understand how FastMM works, then you should download and read the source. For example, that defines TSmallBlockTypeState like so:

TSmallBlockTypeState = 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: NativeUInt;
  {The total address space reserved for this block type (both allocated and
   free blocks)}
  ReservedAddressSpace: NativeUInt;
end;

As you can see, the comments document the record's fields.

like image 136
David Heffernan Avatar answered Feb 01 '26 12:02

David Heffernan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!