Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What replaces the deprecated AllocMemSize

I am maintaining a legacy application and I have the following line of code:

sb.Panels[3].Text:= ' Memory in use: ' +  IntToStr(AllocMemSize);

And it gives the following warning:

[dcc32 Warning] BLOB.pas(8242): W1000 Symbol 'AllocMemSize' is deprecated

and indeed, AllocMemSize is deprecated (from System.pas):

var
  AllocMemSize: Integer deprecated; {Unsupported}

My question is this: What is the replacement for AllocMemSize? Is there any point? Is there some other more meaningful measure I can put there?

(I guess I can just delete the call and output entirely, but users apparently want to see this information in the Status Bar)

like image 839
Nick Hodges Avatar asked Mar 22 '13 14:03

Nick Hodges


1 Answers

Call GetMemoryManagerState instead. It returns similar information, although not necessarily distilled down to a single number like AllocMemSize. The deprecation is due to Delphi's switch around Delphi 2006 to using FastMM for the memory manager, and it tracks memory differently from the older memory manager.

See also Monitoring memory usage in the documentation.

like image 134
Rob Kennedy Avatar answered Oct 18 '22 07:10

Rob Kennedy