[squeak-dev] how/where is memory returned to the OS?

Igor Stasenko siguctua at gmail.com
Fri Oct 19 21:53:09 UTC 2012

To be more precise:
the function which responsible for that is sqShrinkMemoryBy()

on windows it is disabled

in unix sources (sqUnixMemory.c), it saying merely the same:

 *   The code allows memory to be overallocated; i.e., the initial
 *   block is reserved via mmap() and then the unused portion
 *   munmap()ped from the top end.  This is INHERENTLY DANGEROUS since
 *   malloc() may randomly map new memory in the block we "reserved"
 *   and subsequently unmap()ped.  Enabling this causes crashes in
 *   Croquet, which makes heavy use of the FFI and thus calls malloc()
 *   all over the place.
 *   For this reason, overallocateMemory is DISABLED by default.
 *   The upshot of all this is that Squeak will claim (and hold on to)
 *   ALL of the available virtual memory (or at least 75% of it) when
 *   it starts up.  If you can't live with that, use the -memory
 *   option to allocate a fixed size heap.

so, it never munmap()'s the mapped memory.
that's why it showing 512M in use, while in fact your image might need
much less than that :)

Best regards,
Igor Stasenko.

More information about the Squeak-dev mailing list