System.New

From Appmethod Libraries
Jump to: navigation, search

Object Pascal

procedure New(var X: Pointer);

Properties

Type Visibility Source Unit Parent
procedure public System.pas System System

Description

Creates a new dynamic variable and sets P to point to it.

In Object Pascal code, the New procedure creates a new dynamic variable and sets a pointer variable to point to it. P is a variable of any pointer type. The size of the allocated memory block corresponds to the size of the type that P points to. The newly created variable can be referenced as P^. If there is not enough memory available to allocate the dynamic variable, an EOutOfMemory exception is raised.

When an application is finished using a dynamic variable created with New, it should dispose of the memory allocated for the variable using the Dispose standard procedure.

See Also


Code Examples