PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Special case: the dynamic arrays
  • Special case: the dynamic automation objects
  • Special case: the class objects and the dynamic class objects
  • Freeing the memory space
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Delete (Reserved word)
In french: Libérer
The memory occupied by a dynamic object (array, class object, ...) is automatically freed when the object is no longer used or when closing the element (window, report, ...) in which the dynamic object was declared.
Delete is used to explicitly free the memory occupied by:
The use of Delete is optional. Delete allows the developer to quickly free the available memory space.
Versions 16 and later
Universal Windows 10 App This feature is available for the Windows Phone applications.
New in version 16
Universal Windows 10 App This feature is available for the Windows Phone applications.
Universal Windows 10 App This feature is available for the Windows Phone applications.
Versions 17 and later
iPhone/iPad This feature is available for the iPhone/iPad applications.
New in version 17
iPhone/iPad This feature is available for the iPhone/iPad applications.
iPhone/iPad This feature is available for the iPhone/iPad applications.
Versions 18 and later
Universal Windows 10 App This feature is available in Windows Store apps mode.
Android Widget This feature is available in Android Widget mode.
New in version 18
Universal Windows 10 App This feature is available in Windows Store apps mode.
Android Widget This feature is available in Android Widget mode.
Universal Windows 10 App This feature is available in Windows Store apps mode.
Android Widget This feature is available in Android Widget mode.
Versions 21 and later
Universal Windows 10 App This feature is available in Universal Windows 10 App mode.
Apple Watch This feature is available in Apple Watch mode.
New in version 21
Universal Windows 10 App This feature is available in Universal Windows 10 App mode.
Apple Watch This feature is available in Apple Watch mode.
Universal Windows 10 App This feature is available in Universal Windows 10 App mode.
Apple Watch This feature is available in Apple Watch mode.
Example
CustomerArray is dynamic array
CustomerArray = new dynamic array of 4 by 7 int
...
// Free the dynamic array
delete CustomerArray
Syntax
Delete <Name of Dynamic Object to Free>
<Name of Dynamic Object to Free>: Character string
Name of the dynamic object to free explicitly. This dynamic object can correspond to:
Remarks

Special case: the dynamic arrays

  • A dynamic array is automatically freed at the end of the lifetime of the variable (when the window is closed for example) or when allocating new dimensions.
  • If the declaration and the allocation of the dynamic array are performed in a single code line, Delete must not be used to explicitly free the dynamic array. A runtime error will occur if Delete is used.
    See Dynamic arrays for more details.

Special case: the dynamic automation objects

The dynamic automation object is automatically freed at the end of the process containing its declaration or during a new allocation of the object.
Versions 16 and later

Special case: the class objects and the dynamic class objects

To free an object, you also have the ability to use the following syntax:
<Object Name> = NULL
New in version 16

Special case: the class objects and the dynamic class objects

To free an object, you also have the ability to use the following syntax:
<Object Name> = NULL

Special case: the class objects and the dynamic class objects

To free an object, you also have the ability to use the following syntax:
<Object Name> = NULL

Freeing the memory space

You can also:
  • Free the memory space used by a matrix with MatDelete.
  • Free the memory space occupied by a matrix used by a chart with grDeleteAll.
Android Special case in Java/Android
The concept of destructor does not exist in Java/Android. Therefore, the code found in the destructor of a class will never be run.

An object is freed by the garbage collector when it is no longer referenced in the application. There is no way to foresee the moment when this operation occurs.

To force an object to be freed, you have the ability to assign it to NULL or to use the Free statement.
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment