[MLton] totalSwap info in runtime/gc.c

Matthias Kretschmer mccratch@gmx.net
Sat, 15 Nov 2003 09:49:09 +0100


On 14. Nov 2003, at 19:33 Uhr, Stephen Weeks wrote:

>
>> I have a question regarding the runtime system, especially the
>> totalSwap information. Mac OS X dynamically enlarges its swap space
>> when needed, so how is totalSwap used in the garbage collector?
>
> Looking at gc.c it's only used in two places.
>
> 1. If the amount of live memory is greater than totalRam + totalSwap,
> then the runtime aborts.
>
> 2. When deciding on heap size (heapDesiredSize), the runtime makes
> sure to not request more than totalRam + totalSwap.
>
>> I could report the current swap size, but maybe I could just report
>> current swapsize plus half of the free disk space or something...
>
> I don't know what size the current swap size on a Mac typically is.
> Do you know anything like the swap size can always at least grow to at
> least the RAM size?  I would be fine with reporting the swap size as
> RAM size, or 1/2 RAM size, or something like that.  If you undershoot,
> then some program may not be able to run, but in reality once things
> start swapping badly, they're not gonna run anyways.  It's no big deal
> if you overshoot, since some later mmap will simply fail and the
> runtime will try a smaller value.

swap is allocated in chunks of 80MB in size (but you can change it in 
/etc/rc), if the real RAM is exhausted and swap is needed, then it 
begins enlarging the swap.

I think I will try to overshoot - I personally never close 
applications, so I use swap heavily for all those currently unused 
apps, don't want applications to break because of this :)

Swap + half of the available disk space where the swap is, should be a 
good approximation, but I am open for better ideas.

>
> _______________________________________________
> MLton mailing list
> MLton@mlton.org
> http://www.mlton.org/mailman/listinfo/mlton
>
--
Gruss
Matthias Kretschmer