Skip to Main Content
Delphi High Performance
book

Delphi High Performance

by Primož Gabrijelčič
February 2018
Intermediate to advanced content levelIntermediate to advanced
336 pages
7h 52m
English
Packt Publishing
Content preview from Delphi High Performance

Replacing the default memory manager

While writing a new memory manager is a hard job, installing it in Delphi—once it is completed—is very simple. The System unit implements functions GetMemoryManager and SetMemoryManager that help with that:

type  TMemoryManagerEx = record    {The basic (required) memory manager functionality}    GetMem: function(Size: NativeInt): Pointer;    FreeMem: function(P: Pointer): Integer;    ReallocMem: function(P: Pointer; Size: NativeInt): Pointer;    {Extended (optional) functionality.}    AllocMem: function(Size: NativeInt): Pointer;    RegisterExpectedMemoryLeak: function(P: Pointer): Boolean;    UnregisterExpectedMemoryLeak: function(P: Pointer): Boolean;  end;procedure GetMemoryManager(var MemMgrEx: TMemoryManagerEx); overload; ...
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.
Start your free trial

You might also like

Delphi Cookbook

Delphi Cookbook

Daniele Teti

Publisher Resources

ISBN: 9781788625456Supplemental Content