Last updated at 8:46 am UTC on 16 December 2021
A Project file, often with a .pr extension, stores a subset of the object graph in a serialized form. When working with an image containing a large number of objects, the VM may run out of memory space. To avoid this risk, object graphs may be subdivided into smaller subgraphs called Projects. Each project's subgraph may be filed out (swapped out) to save space. Later, the subgraph may be restored by loading it from a file.
A Project file is a Zip archive. One of its contents is a changeset (also with a .pr extension) that contains a serialized object subgraph and the code that will restore the objects from this byte stream. The changeset may be compressed to save space.
A Project may be loaded back into Squeak using the FileList tool or by dropping a *.pr file into Squeak.
Within a live image, an ImageSegment is used to wrap around the subgraph. It substitutes swapped out objects with proxies. When a project is loaded back, the proxies are replaced with their respective objects.
Notes about the implementation of loading a *.pr file
Pr files are loaded with a call to the ProjectLoading class. This class has no instance methods. All methods required to load a project are added on the class side.
ProjectLoading openOn: stream
does the work (details).
The method ends with
Project current openViewAndEnter: anObject
whereas anObject holds the object with the newly loaded content of the pr file.
It may often be better not to save a whole project but rather a single morph. That morph however complex, may be saved in a*.morph file.
A *.morph file may also be dropped onto a desktop and thus loaded into Squeak.