You can unload compiled methods into an image component file or byte array without unloading any classes. However, to load the methods, the target image must hold classes having the same definitions as those used for the methods in the source image. The system sets source code pointers to void during unloading.
To unload methods, you use the method dumpMethods: contained in ApplicationDumper.
Example: Unloading one method and Example: Unloading many methods illustrate how to unload methods.
To unload the compiled method at: contained in the class Object into an image component file, you evaluate:
"Step 1: Unload the compiled method at: into at.ic." | result | (result := ApplicationDumper new) dumpMethods: (Array with: Object>>#at:); dumpIntoFileNamed: 'at.ic' path: '.' using: ComponentMaps.
To unload the compiled methods at: and new contained in the class Object into an image component file, you evaluate:
"Step 1: Unload the compiled methods at: and new into obj.ic." | result | (result := ApplicationDumper new) dumpMethods: (Array with: Object>>#at:; with: Object>>#new); dumpIntoFileNamed: 'obj.ic' path: '.' using: ComponentMaps.