System.ReallocMemory

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

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

C++

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

Properties

Type Visibility Source Unit Parent
function public
System.pas
System.hpp
System System

Description

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