[MLton] totalSwap info in runtime/gc.c
Fri, 14 Nov 2003 10:33:04 -0800
> 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.