Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Smalltalk removeAllUnSentMessages
Last updated at 2:57 pm UTC on 16 January 2006
The following code snippet removes all unsent messages in an image. Be aware that there are methods which are called manually; they are removed as well. Within the method body of #removeAllUnSentMessages there is literal array defined with methods not to remove. You may add your own there as well.

The operation is dangerous and Squeak may easily hang.

[Smalltalk removeAllUnSentMessages > 0]
whileTrue:
[Smalltalk unusedClasses do: [:c | (Smalltalk at: c) removeFromSystem]].
SystemOrganization removeEmptyCategories.
Smalltalk allClassesDo: [:c | c zapOrganization].
Smalltalk garbageCollect.