Name
AllocMemCount Variable
Syntax
var AllocMemCount: Integer;
Description
AllocMemCount stores the number of blocks
allocated by Delphi’s memory
manager.
Tips and Tricks
Delphi doesn’t use the
AllocMemCountvariable for anything—it is purely for informational purposes. Changing its value, although pointless, is also harmless.If you write your own memory manager, check
AllocMemCountbefore callingSetMemoryManager.AllocMemCountshould be zero. If it is not, the default memory manager has allocated at least one block. The problem is that Delphi might try to free that block by calling your custom memory manager. Unless your memory manager can handle this situation, it is safest to halt the program.If you write your own memory manager, you can set
AllocMemCountto reflect the number of blocks allocated by your memory manager.If you use DLLs,
AllocMemCountmight not reflect the blocks allocated in other modules. If you use theShareMemunit, call itsGetAllocMemCountfunction to count the number of blocks it has allocated for all the modules that useShareMem.
See Also
| AllocMemSize Variable, Dispose Procedure, FreeMem Procedure, GetHeapStatus Procedure, GetMem Procedure, GetMemoryManager Procedure, New Procedure, ReallocMem Procedure, SetMemoryManager Procedure |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access