Dynamic system memory use

John M McIntosh johnmci at smalltalkconsulting.com
Fri Feb 1 09:22:55 UTC 2002


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

I started with mmap because of the linux work. Also I'm not sure if 
malloc would reserve all 512mb right away for me.

>
>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.

Good question, when does the grow happen? Versus if you have 500MB of 
free space.

>
>>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

I'd be interested to know what they are, and if you can issue 
MADV_FREE without fear, since it seems the proper way to do things.

-- 
--
===========================================================================
John M. McIntosh <johnmci at smalltalkconsulting.com> 1-800-477-2659
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
===========================================================================



More information about the Squeak-dev mailing list