[gambit-list] Make the default heap size 1MB
feeley at iro.umontreal.ca
Fri Jan 4 13:29:42 EST 2013
On 2013-01-04, at 9:00 AM, Mikael <mikael.rcv at gmail.com> wrote:
> I believe at least expert users may like to check the memory consumption statistics for programs, and a too big size of a newly started Gambit might give the impression that Gambit is memory-costly or something.
> Therefore, if the minimum heap size will be a fixed number:
> I'd guess noone will find Gambit memory-heavy as long as the binary + C stack + heap of a newly launched Gambit takes less than 10MB.
> To make that happen, I suppose a fixed default minimum heap setting would be no more than ~2.5MB (binary ~3.8MB + 2.5MBx2=5MB heap = ~8.8MB, completely fine).
I'm not sure why you multiply the heap size by 2. The (min and max) heap sizes that are specified in the runtime options account for all of the heap (including both the fromspace and tospace of the copying collector, and the space for the still objects).
In any case, I have just pushed changes to the runtime which take the (highest level) cache size into account. The default minimum heap size will be 1/2 of the cache size, or 1 MB, whichever is larger.
The code to get the cache size is in lib/os.c and it has been tested on Mac OS X and linux. It seems quite complex to get this information on Windows so I haven't implemented it. If someone would like to contribute that code, please send me a patch.
Now, on my Mac which has a 6 MB cache, mbrot runs 3.5 times faster than before (with the default runtime options, which gives a 3 MB heap). The resident memory size of the process is now 6.75 MB instead of 3.5 MB.
More information about the Gambit-list