From RAD Studio API Documentation
Jump to: navigation, search


procedure ReallocMem(var P: Pointer; Size: Integer);


Type Visibility Source Unit Parent
procedure public System.pas System System


ReallocMem reallocates 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 ReallocMem, passing the existing memory block pointer in P and the revised block size in Size. If ReallocMem 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. The content of the newly allocated memory is not set to zero.

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