RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
System.GetMem Function

Creates a dynamic variable and a pointer to the address of the block.

Pascal
procedure GetMem(var P: Pointer; Size: Integer);
C++
GetMem(void * P, int Size);

System

P is a variable of any pointer type. Size is an expression specifying the size in bytes of the dynamic variable to allocate. Access the newly allocated memory by dereferencing the pointer; that is, use P^.  

If there isn't enough memory available to allocate the dynamic variable, an EOutOfMemory exception is raised.

Note: It is considered preferable to use the New and Dispose procedures rather than GetMem and FreeMem.
 

 

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