[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] Reference for unit 'System' (#rtl)

GetMem

Allocate new memory on the heap

Declaration

Source position: heaph.inc line 83

procedure Getmem(

  out p: pointer;

  Size: PtrUInt

);

function GetMem(

  size: PtrUInt

):pointer;

Description

Getmem reserves Size bytes memory on the heap, and returns a pointer to this memory in p. 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. The default value is False, so by default an error is generated.

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 Freemem.

Errors

None.

See also

Freemem

  

Release allocated memory

Dispose

  

Free dynamically allocated memory

New

  

Dynamically allocate memory for variable

returnnilifgrowheapfails

  

Describe behaviour if getmem fails.


Documentation generated on: Nov 16 2015