Programmer's Reference

Instance accessing

allInstances, basicAllInstances

Note:allInstances is a Blue Book message. It is defined in IBM Smalltalk to return all live instances of a class. Live instances are those that are being referenced by another (referenced) object, and so will not be reclaimed by the next pass of the garbage collector. (Garbage collection is a Smalltalk process for periodically identifying unreferenced objects and deallocating their memory.) Sending allInstances usually forces a garbage collection to ensure that only live instances are returned. The message basicAllInstances is not in the Blue Book, but experience indicates it is necessary. It is generally faster because it does not require the garbage collection; however, all of the returned instances are not guaranteed to exist.
Porting tip:Neither Smalltalk/V nor Objectworks\Smalltalk supports basicAllInstances, although Smalltalk/V does have a message with similar semantics called allInstancesPrim. Smalltalk/V supports allInstances. Objectworks\Smalltalk also has a message named allInstances, but it has the semantics of basicAllInstances.


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