RFR(S): 8025942: Implement os::Bsd:available_memory

Gerard Ziemski gerard.ziemski at oracle.com
Fri Oct 11 08:26:00 PDT 2013


hi David,

On 10/10/2013 11:32 PM, David Holmes wrote:
> Hi Gerard,
>
> On 11/10/2013 5:14 AM, Gerard Ziemski wrote:
>> Please review this fix that implements os::Bsd:available_memory()
>>
>> Description:
>>
>> This is a simple change - we use a similar implementation that Apple
>> itself uses (see
>> http://opensource.apple.com/source/system_cmds/system_cmds-498.2/vm_stat.tproj/vm_stat.c) 
>>
>> to implement BSD (Apple platform only) implementation for finding out
>> available (free) memory.
>
> Is host_statistics64 likely to fail? If not then I think we should 
> trap any failures, at least with an assert, so that they are noticed. 
> Otherwise this might fail all the time and we would be none the wiser.

I looked at the implementation of host_statistics64 in XNU src and the 
only reason it will fail is if we pass wrong parameters (such as NULL 
host). Otherwise, it is guaranteed to return a valid value, so there 
does not seem to be a need for an assert here.


cheers


More information about the hotspot-dev mailing list