TLama

Untitled

Mar 22nd, 2013
619
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.55 KB | None | 0 0
  1. function GetAllocMemSize: Integer;
  2. {$IF CompilerVersion >= 18}
  3. var
  4.   I: Integer;
  5.   MemMgrState: TMemoryManagerState;
  6. {$IFEND}
  7. begin
  8. {$IF CompilerVersion < 18}
  9.   Result := AllocMemSize;
  10. {$ELSE}
  11.   GetMemoryManagerState(MemMgrState);
  12.   Result := MemMgrState.TotalAllocatedMediumBlockSize +
  13.     MemMgrState.TotalAllocatedLargeBlockSize;
  14.   for I := 0 to High(MemMgrState.SmallBlockTypeStates) do
  15.     Result := Result + MemMgrState.SmallBlockTypeStates[I].InternalBlockSize +
  16.       MemMgrState.SmallBlockTypeStates[I].UseableBlockSize;
  17. {$IFEND}
  18. end;
Advertisement
Add Comment
Please, Sign In to add comment