From RAD Studio API Documentation
Jump to: navigation, search


function ReallocMemory(P: Pointer; Size: NativeInt): Pointer; cdecl;


extern DELPHI_PACKAGE void * __cdecl ReallocMemory(void * P, NativeInt Size);


Type Visibility Source Unit Parent
function public
System System


ReallocMemory resizes a memory block.

GetMem allocates a block of the given Size on the heap. If you have to change the size of this memory block, call ReallocMemory, passing the existing memory block pointer in P, and the revised block size in Size. A pointer to the resized memory block is returned. If ReallocMemory 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 there is not enough memory available to extend the memory block to the desired size, an EOutOfMemory exception is raised.

Note: ReallocMemory is the version of ReallocMem compatible with C++.

See Also

Code Examples