RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
System.ReallocMemory Function

ReallocMemory resizes a memory block.

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

System

GetMem allocates a block of the given Size on the heap. If you need 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 can't 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 isn't enough memory available to extend the memory block to the desired size, an EOutOfMemory exception is raised.

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

 

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