[squeak-dev] Low Memory Warning although enough memory is available

David T. Lewis lewis at mail.msen.com
Sat Feb 26 20:22:14 UTC 2011

On Sat, Feb 26, 2011 at 03:15:23PM +0100, r2ruyu-nana at yahoo.de wrote:
> Hiya!
> We encounter problems with low memory warnings ("Space is low", "Warning! 
> Squeak is almost out of memory!").
> Setup here:
>   * Squeak 3.9 (tested also with 4.2)
>   * Win32
>   * 2GB of memory
> We can reproduce the problem here with:
> 	bmp1 := Form fromFileNamed: 'hauptabschnitt_lang.bmp'.
> 	bmp2 := Form fromFileNamed: 'hauptabschnitt1.bmp'.
> 'hauptabschnitt_lang.bmp' is 24 bit, 273,8MB file.
> 'hauptabschnitt1.bmp' is 24 bit, 95,8MB file.
> 'Doing" the first line works, doing the second popups the low memory warning. 
> With the task manager we see Squeak using about 412MB after the first line. 
> There should be enough memory left for Squeak. 
> How to make both lines work? As stated in the wiki [1], the "-memory: N" 
> argument is out of date. Indeed, Squeak behaves equal with different N (we 
> tried 512, 768, 1024, 2048; but it's interesting that this parameter is still 
> accepted by Squeak 3.9).
> I tried Squeak 4.2 but it's the same (although it needs overall 398MB after 
> the first line).
> (By the way, executing the first line above is quite fast - but doing the same 
> with equivalent png-file is about 5x slower - how come?)
> Any hints on this?

I tried making a 393 MB bitmap file, and was able to load this using
up-to-date VMs on Linux (both the standard VM and Cog). There may be
differences on Windows (I did not test this), but I note that the standard
Windows VM is scheduled for an update in the next couple of weeks, so
this may change.  You may want to try a Cog VM for Windows (which is
probable a bit more up to date right now) and see if this makes a

On the other hand, with bitmaps of this size you may be encountering
limitations of the current object memory and VM. When you read the BMP
file into a form, the contents of the file are loaded into a single
instance of Bitmap. This Bitmap object consumes more space that the bitmap
file itself, because the 24 bit pixels are stored in 32 bit slots in the
Bitmap. That means that when you try to load a 274MB bitmap file, you will
be allocating an Bitmap that uses more than 274 MB of space in your object
memory. The current Squeak VMs can allocate single objects on the order
of about 1GB, plus or minus a bit depending on what version of VM you are
running and which way the wind is blowing. There could be differences in
the support code that may cause this limit to be different on different
operating systems (I only tried it on Linux).

FWIW, the largest single objects that I have been able to allocate are
on a standard VM on Linux with a 64-bit object memory. In this case I
can allocate rather large string objects:
  (String new: 1000000000) size ==> 1000000000

For objects larger than this, additional changes will be needed to the
VM and object memory (I believe that Eliot has plans to pursue this at
some point).


More information about the Squeak-dev mailing list