Home > Language Reference > Functions > System functions

Unload Function

Frees up memory space associated with a resource.

Syntax

Public Sub Unload (ByRef x As Bitmap)
Public Sub Unload (ByRef
x As Form)

ParameterDescription
xAn instance of an object which is associated to a resource.

Remarks

The Unload function frees up memory space taken up by a resource previously loaded by the Load function. The effect of this function depends on the type of the object passed as parameter:

Type Action
BitmapIf the object is associated with a resource, it is released. If any modifications have been made to the image, they are lost. Next time this object is accessed, the original image will be reloaded.
Form and its derivativesUnloading the resource, erasing the form if it was displayed, then allowing by the method Show to return if the form was modal. The values contained in the controls on the forms are lost.

The use of Unload on a resource already unloaded has no effect and notably does not cause an error.

The main use of the Unload function is to close a modal dialog box. Refer to the description of the Form object for further details. Note: you should not use the Unload function to unload a non modal form. If you want to close the main form of your application, you should use the Quit method of the Application object.

The Unload function should also be used when you have finished using a Bitmap resource. These are not unloaded automatically by the system (unless they are associated with a Picture control) and use a lot of memory.

System requirements

SystemMinimal versionRemarks
Palm OSPalm OS 3.0N/A