User's Guide

Classes

You can unload classes into an image component without unloading containing applications. To do this, you use the method dumpClasses: contained in ApplicationDumper. It unloads classes along with their class variables, class instance variables, and shared pool variables. Unless you specify values for the variables, it assigns nil to the values upon unload.

You must be careful when transferring classes that contain references to operating system resources such as graphics resources, file handles, or process handles. Upon unload, ENVY/App might replace instances of these classes with nil, making the references undefined. After the components are unloaded and reloaded, you must verify that the newly loaded code properly reinitializes all references to operating system resources.

Example: Unloading one class, Example: Unloading a class and its subclasses, and Example: Unloading many classes illustrate how to unload classes.

Example: Unloading one class

To unload the class String into an image component file, you evaluate the code below. As shown in Step 1 of Example: Unloading an application and its subapplication, create an instance of EaComponentMapManager before unloading the class.

"Unload the class String into string.ic."
| result |
result := ApplicationDumper new.
result
    dumpClasses: (Array with: String);
    dumpIntoFileNamed: 'string.ic' path: '.' using: ComponentMaps.

Example: Unloading a class and its subclasses

To unload the class Number and its subclasses into an image component file, you evaluate:

"Step 1: Unload the class Number and its subclasses into number.ic."
| result |
(result := ApplicationDumper new)
   dumpClasses: Number withAllSubclasses;
   dumpIntoFileNamed: 'number.ic' path: '.' using: ComponentMaps.

Example: Unloading many classes

To unload the both String and Number (with its subclasses) into image component files, evaluate:

"Unload String into string.ic and both String and Number into both.ic."
| result |
result := ApplicationDumper new.
result
   dumpClasses: (Array with: String);
   dumpIntoFileNamed: 'string.ic' path: '.' using: ComponentMaps.
result
   dumpClasses: Number withAllSubclasses;
   dumpIntoFileNamed: 'both.ic' path: '.' using: ComponentMaps.

Note that the effects of using dumpClasses: are cumulative, persist between unloading operations, and cannot be undone. The code's second use of dumpClasses: unloads both String and Number into a file. To remove a class from a file, you must create a new instance of ApplicationDumper and unload the classes you want into the file.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]