RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
System.SysReallocMem Function

Returns a pointer to a specified number of bytes, preserving the values pointed to by the Pointer parameter.

Pascal
function SysReallocMem(P: Pointer; Size: Integer): Pointer;
C++
void * SysReallocMem(void * P, int Size);

System

When implementing a custom memory manager, use SysReallocMem to change the size of a dynamically allocated chunk of memory. If SysReallocMem can't expand the memory block point 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: On Windows, 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.
Note: On Linux, the System unit provides an implementation of SysReallocMem that supports reference counting and shared objects. The ShareMem unit is not provided for Linux.
 

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