Dynamic system memory use

Marcel Weiher marcel at metaobject.com
Fri Feb 1 08:44:46 UTC 2002


On Friday, February 1, 2002, at 08:59 , John M McIntosh wrote:
>
> For OS-X I mmap as anonymous 512MB.

Any particular reason for using mmap() and not just simply malloc()?  It 
will have the same semantics of just allocating address-space.

One reason for mmap() would be that you can use it to create a private 
swapfile, which can be significantly better than going through the 
system swapfiles in some circumstances.

Also, I started implementing the grow/shrink primitives, but then 
couldn't figure out how such an implementation differs from simply 
starting Squeak with -memory 512, in the presence of a lazy VM subsystem.

> Technically I could do an madvise with MADV_FREE when we shrink to 
> state the excess pages
> aren't needed and can be freed but maybe we should see what the 
> behavior is first. Mmm
> actually doing the MADV_FREE might be a good idea, we'll see for 3.2.3, 
> I suspect it will make the VM subsystem more happy, actually some 
> reading shows it will make it *very* happy.

You have to be careful with these.  Some are not supported, some don't 
really work and others give you kernel panics. Apple has some 
bug-reports from me...

Marcel




More information about the Squeak-dev mailing list