Skip to content

Using Permanent Space

Pablo Tesone edited this page Feb 15, 2024 · 10 revisions

The support for permanent space and the new image format is available in the stock VM since version v10.1.0. Once objects are migrated to the permanent space, the new image format should be used. An extension to the single file image format will be done, so it can be used with the old image format.

Migrating objects to Permanent Space

To migrate objects to permanent space is need to load the following baseline:

For Pharo 11:

Metacello new
	baseline: 'PermSpaceSupport';
	repository: 'github://pharo-project/PermSpaceSupport:v1.1.0';
	onConflictUseIncoming;
	load.

For Pharo 12:

Metacello new
	baseline: 'PermSpaceSupport';
	repository: 'github://pharo-project/PermSpaceSupport:Pharo12';
	onConflictUseIncoming;
	load.

Then there are two possible paths, migrate to permanent space classes, methods and literals; or migrate all saved objects. The first solution is slower but selects the objects that we want to move. By doing so, we don't migrate objects that later will be referenced. The second solution is more general and faster, and migrates all existing instances to permanent space.

Migrating Classes, Methods and Literals

Then execute the expression to migrate the objects:

aPermSpace := PermSpaceInBulk new.

RPackageOrganizer default packages
	do: [ :e | e moveContentToPermSpace: aPermSpace ].
aPermSpace flush

And then we save the image in the new format with:

Smalltalk convertToComposedImageFormat.

This will replace the existing image, it is possible to save it with another name using:

Smalltalk convertToComposedImageFormatAs: 'newImageName'.

Migrating All Old Spaces to Perm Space

Then execute the expression to migrate all objects:

PermSpace new moveToPermSpaceAllOldObjects

And then we save the image in the new format with:

Smalltalk convertToComposedImageFormat.

This will replace the existing image, it is possible to save it with another name using:

Smalltalk convertToComposedImageFormatAs: 'newImageName'.