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.
Three examples illustrate how to unload classes
Example: Unloading one class
To unload the class String into an image component file, you evaluate the code below.
"Step 2: 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 2: 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:
"Step 2: 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.
Last modified date: 01/29/2015