Determining Allocated Memory in Delphi
One of the new features of BDS 2006 is a new memory manager. As a result, all of the old ways to get the amount of allocated memory have been deprecated. It is surprising to me that they did not give you an alternative way to get this information, but thanks to some searching of the FastMM code, here is a method to get the amount of allocated memory for your process.
function AllocatedMemory: Cardinal;
var
MemoryManagerState: TMemoryManagerState;
SmallBlockState: TSmallBlockTypeState;
begin
GetMemoryManagerState(MemoryManagerState);
Result := 0;
for SmallBlockState in MemoryManagerState.SmallBlockTypeStates do
Inc(Result, SmallBlockState.AllocatedBlockCount * SmallBlockState.UseableBlockSize);
Inc(Result, MemoryManagerState.TotalAllocatedMediumBlockSize);
Inc(Result, MemoryManagerState.TotalAllocatedLargeBlockSize);
end;
July 12th, 2008 at 6:41 am
Great blog, but i couldnt understand where can i subscribe to your rss feed?
August 13th, 2008 at 4:21 am
Cool. Come by and hypnotize yourself if you please
August 16th, 2008 at 3:57 am
I wish you would post more often…this is my “coffee drinking” blog:) Edgar Allen
August 23rd, 2008 at 11:35 am
Interesting point of view. I’ll consider changing my mind about this but for now I still don’t see things the same way you do.
September 6th, 2008 at 11:03 am
You’re right on. Couldn’t have said it better myself. -Pete
September 13th, 2008 at 6:53 am
Love your site it is very informative am going to research the other posts to see what else I can learn, cheers! and keep up the great work!
September 18th, 2008 at 11:13 am
Hi, I found your blog on this new directory of WordPress Blogs at blackhatbootcamp.com/listofwordpressblogs. I dont know how your blog came up, must have been a typo, i duno. Anyways, I just clicked it and here I am. Your blog looks good. Have a nice day. James.
October 2nd, 2008 at 7:26 am
Nice. Thanks.
Pak Tam