[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] |
Dynamically allocate memory for variable
Source position: system.fpd line 54
procedure New( |
var P: Pointer |
); |
var P: Pointer; |
Cons: TProcedure |
); |
New allocates a new instance of the type pointed to by P, and puts the address in P. If P is an object, then it is possible to specify the name of the constructor with which the instance will be created.
The newly allocated memory is not initialized in any way, and may contain garbage data. It must be cleared with a call to FillChar or FillWord.
For an example, see Dispose.
What happens if no more memory is available, depends on the value of the variable ReturnNilIfGrowHeapfails: if the variable is True then Nil is returned. If the variable is False, a run-time error is generated.
|
Free dynamically allocated memory |
|
|
Release allocated memory |
|
|
Allocate new memory on the heap |
|
|
Describe behaviour if getmem fails. |