Sign in Join
FPDoc Onlineexperiment

ManagedTypes topic

In unit System

A list of managed types.

Declaration

pascal
ManagedTypes

Description

Some of the basic pascal types are managed. This means that their lifetime is treated specially by the compiler: Variables of a managed type:

  • Are implicitly initialized at the beginning of their scope. Usually this means the memory area reserved for them is zeroed out.
  • Use some form of reference counting when they are assigned to one another during their lifetime.
  • Are implicitly finalized at the end of their scope. Usually this means decreasing a reference count and freeing the dynamic memory occupied by the variable if the reference count returns zero.

The following types are managed:

Ansistring
The one-byte character string uses a reference count.
UnicodeString
The two-byte character string uses a reference count
Widestring
Is equal to Unicodestring on non-windows platforms, is managed specially on windows.
Dynamic arrays
Are reference counted.
Interfaces
COM interfaces are reference counted through the mechanisms in IInterface. CORBA interfaces are not managed.

Additionally, structured types such as arrays, records, objects and classes containing one of the above types automatically become managed too. Note that for classes this does not mean that the class instance itself becomes managed, but when creating/destroying the class through the constructor and destructor, the fields in a class that are of managed type will be initialized and finalized.

For more information about the exact workings for each type, please consult the language reference guide.

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.