System.SysReallocMem
Delphi
function SysReallocMem(P: Pointer; Size: NativeInt): Pointer;
C++
extern DELPHI_PACKAGE void * __fastcall SysReallocMem(void * P, System::NativeInt Size);
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
function | public | GETMEM.INC System.hpp |
System | System |
Description
Returns a pointer to a specified number of bytes, preserving the values pointed to by the Pointer
parameter.
When implementing a custom memory manager, use SysReallocMem to change the size of a dynamically allocated chunk of memory. If SysReallocMem cannot expand the memory block pointed to by P
, it frees the referenced memory, and copies the values to the newly allocated memory that is returned. If Size
is less than the number of bytes pointed to by P, only the first Size bytes are preserved. Otherwise, the entire value of the memory pointed to by P is preserved in the newly allocated memory.
Note: The System unit provides a limited implementation of SysReallocMem. If the custom memory manager needs to support reference counting and objects that can be shared between processes, use the implementation of SysReallocMem, provided by the ShareMem unit. When used, ShareMem must be the first unit in the project file, to enforce a consistent memory management model.
Warning: This is an internal function and should not be called directly by any application. Use the ReallocMem function instead.