I don't know a lot about this, so I might be misunderstanding the way it works, but it seems to me like Squeak takes a fixed size chunk of system memory on startup and then hands it to its own internal memory managers to do its own allocation scheme. If this is right, then this would have to be one of my primary complaints about Squeak; even the simplest, most stripped down program can take a large amount of memory, and, more importantly, a program that cannot anticipate beforehand how much memory it will need is unable to dynamically use only as much of the system memory as necessary (hurts runtime scalability).
Is there a solution to this in Squeak or is this a design issue?
-Derrick Coetzee
On Wednesday 30 January 2002 06:16 am, Derrick Coetzee wrote:
I don't know a lot about this, so I might be misunderstanding the way it works, but it seems to me like Squeak takes a fixed size chunk of system memory on startup and then hands it to its own internal memory managers to do its own allocation scheme.
[snip]
Is there a solution to this in Squeak or is this a design issue?
The latest versions of the Squeak VM can grab more memory if needed, so you can specify a maximum and Squeak won't use it unless it needs to.
Squeak can increase the memory it uses if the OS supports a suitable method of extending the original allocation - or potentially making a new larger allocation and copying the entire object memory across and swizzling all the pointers. See the macros #define sqGrowMemoryBy(oldLimit, delta) oldLimit #define sqShrinkMemoryBy(oldLimit, delta) oldLimit #define sqMemoryExtraBytesLeft(includingSwap) 0 in sq.h and their uses.
Other Smalltalks with more complex object memory models can do it other ways; VW has (last time I looked) a half-dozen or so memory spaces and can add memory in the old-space region.
One of the classic problems with trying to extend or reduce memory usage is thrashing; you do all the work of getting more or releasing some and - wham, you need to reverse and do the opposite. I did a version once that tried a hysterisis approach of never releasing more than one previously added segment jst in case and that worked quite well in the seriously memory constrained environment in which it lived (1Mb ram total on the machine).
tim
squeak-dev@lists.squeakfoundation.org