FAQ: Assigning memory to the VM at startup
Last updated at 9:24 pm UTC on 14 November 2006
IMPORTANT: The following is only true for Squeak pre-2.9; later Windows VMs allocate memory dynamically, e.g., there is neither a need nor a way of explicitly assigning memory. ar
On Windows you can start Squeak from the command line using the switch
[note the space] e.g., if you start Squeak by
Squeak -memory: 64 Squeak.image
you'll have 64MB of memory available.
You may use a shortcut on your desktop and do something like:
D:\develop\squeak\v2_6\Squeak.exe -memory: 128 D:\develop\squeak\v2_6\2.6.image
D:\develop\squeak\v2_6\Squeak.exe -memory: 128 2.6.image
since the image and the VM are in the same directory.
For more information on the Windows VM's command-line switches, see VM Command Line Options.
On the Mac, you can simply edit the amount of memory by doing a "Get Info" on the VM, and increasing the memory allotment in the dialog.
The Carbon VM under OS-X will allocate 512MB of virtual memory, and use as much real memory as required. If you exceed the amount of real ram in your macintosh then things will get very very slow. It uses the same logic as the dynamic memory allocation Windows VM.
For the mach-o carbon VM 3.2.x or higher this was changed to only allocate 512mb because of issues with the squeak memory model.
For VM 3.5.1b5 or higher we have an info.plist attribute that allows you to pick the upper limit. Because of memory usage/allocation issues going over 1GB may or may not be feasible. As like the Unix VM later versions of the carbon VM will let you set the memory size via the command line.
The Carbon VM (pre 3.2.x) under OS-9 will attempt to part of the allocation via "Get Info". IE if you allocate 96MB, then it might only use 20MB, it will grow to 96MB (usually, sometimes this will fail). However you should be using the carbon version under OS-X, not under OS-9
The 3.2.x series of VM under OS-9.2.x will attempt to allocate 128MB of virtual memory for Squeak, unless VM is turned off, or if you have allocated more than 128MB of memory in get info. Therefore you could change the get memory info to use say 8mb for just the VM C heap, the image then will exist in a 128MB virtual space. This causes some interesting issues for Open/GL when the memory specified is > 128MB because when it is below 128MB, then Open/GL memory comes from the heap and might have upwards of 120MB to work with. Once you go over 128MB then the reserved heap memory is 1MB or so. That causes Open/GL Squeak usage to fail and cause poor performance. Therefore if you set the memory > 128MB and use Open/GL then you must set the reserved memory in Squeak to 20MB+/- to make Open/GL happy
Use the switch "-memory 64m", for 64 Megs. A complete startup command might look like:
SqueakVM-2.7-SGI-irix-6.x -memory 64m Squeak2.7.image
Also, you can get the same effect by setting the environment variable SQUEAK_MEMORY.
Edit the !Squeak.!Run obey file and make the run line be something like:-
/<Squeak$Dir>.!RunImage -memory:32m %0