System.TMemoryManager

From Appmethod Libraries
Jump to: navigation, search

Object Pascal

  TMemoryManager = record
    GetMem: function(Size: NativeInt): Pointer;
    FreeMem: function(P: Pointer): Integer;
    ReallocMem: function(P: Pointer; Size: NativeInt): Pointer;
  end deprecated 'Use TMemoryManagerEx';

C++

struct DECLSPEC_DRECORD TMemoryManager _DEPRECATED_ATTRIBUTE1("Use TMemoryManagerEx")
{
public:
    void * __fastcall (*GetMem)(NativeInt Size);
    int __fastcall (*FreeMem)(void * P);
    void * __fastcall (*ReallocMem)(void * P, NativeInt Size);
};

Properties

Type Visibility Source Unit Parent
record
struct
public
System.pas
System.hpp
System System

Description

Warning: TMemoryManager is deprecated. Please use TMemoryManagerEx.

TMemoryManager defines the memory block entry points.

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

The following table lists the fields of this type and their meaning.



Field Meaning

GetMem

Specifies 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 (Object Pascal) or NULL (C++).

FreeMem

Specifies a function that deallocates the given block. The pointer parameter passed to the FreeMem function will never be nil (Object Pascal) or NULL (C++). If the FreeMem function successfully deallocates the given block, it should return zero. Otherwise, it should return a nonzero value.

ReallocMem

Specifies a function that reallocates the given block to the given new size. The pointer parameter passed to the ReallocMem function will never be nil (Object Pascal) 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 (Object Pascal) or NULL (C++) if the block cannot be reallocated.



See Also