[MLton] available ram

Matthew Fluet fluet@cs.cornell.edu
Wed, 8 Feb 2006 19:16:09 -0500 (EST)


[Moving to MLton@mlton.org, as this is a suggestion for development.]

>> Which ever is used, I would expect that to be the maximum that the
>> machine would ever ask for.
>
> ram-slop is not for specifying a maximum; it is for specifying how
> much RAM is expected to be available before paging occurs.  You may
> want the program to run beyond that limit, but to take paging into
> account (in the very limited way that MLton does).  max-heap is indeed
> for specifying a maximum.  ram-slop and max-heap make sense each on
> their own as well as together.

I think a point of confusion is that

          s->ram = align (s->ramSlop * s->totalRam, s->pageSize);

is a rather poor way of estimating the available ram.  For systems where 
we use  sysconf(_SC_PHYS_PAGES)  to determine the total ram, we might well 
use  sysconf(_SC_AVPHYS_PAGES)  to determine the available ram.  In fact, 
we ought to periodically recompute s->ram from _SC_AVPHYS_PAGES.  I 
imagine that this would give somewhat better dynamic behavior than the 
current situation.  We might well have an  availRamSlop  parameter for 
further customization.