Ticket #2090 (new bug)
Parrot underestimates memory on OS X
|Reported by:||benabik||Owned by:|
On OS X, Parrot uses the HW_PHYSMEM sysctl to determine the amount of memory on the system. Unfortunately, the value returned from it is a signed 32b integer, so we will never know if a system has more than 2GiB of RAM. The sysctl man page suggests using HW_MEMSIZE to get a full 64-bit value.
This doesn't break anything, but as-is, Rakudo spends about 60% of the time building Rakudo's core.pir in gc_gmc_mark_and_sweep, which is triggered when 10% of total memory is allocated. On my system, it would trigger literally half as often if parrot knew much RAM my laptop really had.
Of course, this is complicated by the fact that we previously changed from MEMSIZE to PHYSMEM already in SVN r49633 (git 5977674) due to build errors. Does anyone know what version of Darwin MEMSIZE was introduced in? Perhaps we should check if the HW_MEMSIZE macro exists and only use PHYSMEM if it doesn't?