GetMemoryManagerState,ReservedAddressSpace在Delphi中做了什么?

时间:2013-04-12 11:22:27

标签: delphi

我有一个代码,它给了我一些数字。我不知道这些数字是什么意思。我很好奇,这些数字意味着什么。谢谢你的回答!

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;

1 个答案:

答案 0 :(得分:0)

该信息可在程序文档中找到:TMemoryManagerState。而Memory Management Index的许多主题索引中提供了更多信息。

如果您想真正了解FastMM的工作原理,那么您应该download and read the source。例如,它定义TSmallBlockTypeState,如下所示:

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;

如您所见,评论记录了记录的字段。