Request for review (XS): 8006431: os::Bsd::initialize_system_info() sets _physical_memory too large
mikael.vidstedt at oracle.com
Thu Jan 17 23:09:01 PST 2013
Looks good, assuming u_long is a 64-bit type.
On 17 jan 2013, at 22:36, Bengt Rutisson <bengt.rutisson at oracle.com> wrote:
> Hi all,
> Could I have a couple of reviews for this small fix?
> On OSX we used HW_USERMEM value from sysctl() to get the available physical memory on the machine. This is a 32 bit value but we store it in a 64 bit variable. This means that we get kind of random and normally very large values for what we think the physical memory is.
> We actually don't want a 32 bit value since we want to handle machines with more than 2 or 4 GB of memory. Instead of HW_USERMEM we should be using HW_MEMSIZE which will give us a 64 bit value.
> Thanks Staffan Larsen for both detecting the problem and providing a solution.
> This is a one-word-change. So, to save you a mouse click on the webrev link above, here is the diff:
> --- a/src/os/bsd/vm/os_bsd.cpp
> +++ b/src/os/bsd/vm/os_bsd.cpp
> @@ -260,7 +260,7 @@
> * instead of hw.physmem because we need size of allocatable memory
> mib = CTL_HW;
> - mib = HW_USERMEM;
> + mib = HW_MEMSIZE;
> len = sizeof(mem_val);
> if (sysctl(mib, 2, &mem_val, &len, NULL, 0) != -1)
> _physical_memory = mem_val;
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the hotspot-runtime-dev