Name

AllocMemSize Variable

Syntax

var AllocMemSize: Integer;

Description

AllocMemSize stores the total size in bytes of all the memory blocks allocated by Delphi’s memory manager; that is, it represents the amount of dynamic memory in use by your application.

Tips and Tricks

  • Delphi doesn’t use the AllocMemSize variable for anything. Changing its value, although pointless, is also harmless.

  • If you write your own memory manager, you can set AllocMemSize to reflect the amount of memory allocated by your memory manager.

  • If you use DLLs, AllocMemSize might not reflect the blocks allocated in other modules. If you use the ShareMem unit, call its GetAllocMemSize function to find the size of the blocks it has allocated for all the modules that use ShareMem.

See Also

AllocMemCount Variable, Dispose Procedure, FreeMem Procedure, GetHeapStatus Procedure, GetMem Procedure, GetMemoryManager Procedure, New Procedure, ReallocMem Procedure, SetMemoryManager Procedure

Get Delphi in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.