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

Gerard Ziemski gerard.ziemski at oracle.com
Fri Oct 11 09:16:07 PDT 2013


On 10/11/2013 10:53 AM, Coleen Phillimore wrote:
> On 10/11/2013 11:47 AM, Gerard Ziemski wrote:
>> hi Harold,
>>
>> I don't think that's necessary - the call will fail in 2 cases:
>>
>> 1. null host
>> 2. wrong attribute size
>>
>> Re 1. we use mach_host_self() to get the host - if that were to fail, 
>> we'd have failed long before here.
>> Re 2. the XNU implementation of the call checks that attribute size 
>> is set to HOST_VM_INFO64_COUNT, which is what we use
>>
>> so in my opinion no assert is needed, and adding it might in fact 
>> muddle the waters as any future reader of the code might very well 
>> think that it's likely to fail.
>
> If you add an assert with the message that should provide executable 
> documentation that these conditions are true.

We're going to use a runtime code to document a proper usage of an API? 
Are we then saying we need to document system API calls in such way? 
Because if we do, wouldn't we need to do this for every single API call?

I remain unconvinced that host_statistics64() requires an assert, but 
since the team seems to feel strongly about this, I will add it.


cheers


More information about the hotspot-dev mailing list