System.GetMem
Delphi
procedure GetMem(var P: Pointer; Size: Integer);
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
procedure | public | System.pas | System | System |
Description
GetMem allocates a memory block.
GetMem allocates a block of the given Size
on the heap, and returns the address of this memory in the P
parameter. The bytes of the allocated buffer are not set to zero. To dispose of the buffer, use FreeMem. If there is not enough memory available to allocate the block, an EOutOfMemory exception is raised.
Note: If the memory block must be initialized with zero, you can use AllocMem.
This function is not available in C++. In C++ you can use GetMemory.
In case of a typed pointer, you should consider the New and Dispose procedures, which respectively initialize and finalize the memory block accordingly.