RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
System.TMemoryManagerEx Record

TMemoryManagerEx defines extended memory block entry points.

Pascal
TMemoryManagerEx = record
  GetMem: function(Size: Integer): Pointer;
  FreeMem: function(P: Pointer): Integer;
  ReallocMem: function(P: Pointer; Size: Integer): Pointer;
  AllocMem: function(Size: Cardinal): Pointer;
  RegisterExpectedMemoryLeak: function(P: Pointer): Boolean;
  UnregisterExpectedMemoryLeak: function(P: Pointer): Boolean;
end;
C++
struct TMemoryManagerEx {
  function(Size: Integer): Pointer GetMem;
  function(P: Pointer): Integer FreeMem;
  function(P: Pointer; Size: Integer): Pointer ReallocMem;
  function(Size: Cardinal): Pointer AllocMem;
  function(P: Pointer): Boolean RegisterExpectedMemoryLeak;
  function(P: Pointer): Boolean UnregisterExpectedMemoryLeak;
};

System

The RegisterExpectedMemoryLeak type is used by the GetMemoryManager and SetMemoryManager procedures. It defines the routines that allocate and free memory.  

The GetMem field (Delphi) or method (C++) must specify a function that allocates the given number of bytes and returns a pointer to the newly allocated block, as invoked by the GetMemory routine.  

The Size parameter passed to the GetMem function will never be zero. If the GetMem function cannot allocate a block of the given size, it should return nil (Delphi) or NULL (C++).  

The FreeMem field (Delphi) or method (C++) must specify a function that deallocates the given block. The pointer parameter passed to the FreeMem function will never be nil (Delphi) or NULL (C++). If the FreeMem function successfully deallocates the given block, it should return zero. Otherwise, it should return a non-zero value. As invoked by the FreeMemory routine.  

The ReallocMem field (Delphi) or method (C++) must specify a function that reallocates the given block to the given new size. The pointer parameter passed to the ReallocMem function will never be nil (Delphi) or NULL (C++), and the Size parameter will never be zero. The ReallocMem function must reallocate the given block to the given new size, possibly moving the block if it cannot be resized in place. Any existing contents of the block must be preserved, but newly allocated space can be uninitialized. The ReallocMem function must return a pointer to the reallocated block, or nil (Delphi) or NULL (C++) if the block cannot be reallocated. As invoked by the ReallocMem routine.  

The AllocMem field (Delphi) or method (C++) must specify a function that allocates the given number of bytes and returns a pointer to the newly allocated block, as invoked by the AllocMem routine.  

The RegisterExpectedMemoryLeak field (Delphi) or method (C++) must specify a function that registers a memory location that an application has allocated and does not expect to free, as invoked by the RegisterExpectedMemoryLeak routine.  

The UnregisterExpectedMemoryLeak field (Delphi) or method (C++) must specify a function that removes a memory location from the Memory Manager's list of expected memory leaks, as invoked by the UnregisterExpectedMemoryLeak routine. 

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!