RFR (S): 8132708: Add tests for Humongous objects allocation threshold
kirill.zhaldybin at oracle.com
Mon Aug 24 13:23:15 UTC 2015
Thank you for reviewing this fix.
Could you please read comments inline?
On 24.08.2015 12:53, Thomas Schatzl wrote:
> Hi Kirill,
> On Thu, 2015-08-20 at 19:45 +0300, Kirill Zhaldybin wrote:
>> Could you please review a new simple test checking that only objects
>> allocating more than a half regions are allocated as humongous?
> - MAX_CONTINIUS_SIZE_CHECK: typo in "CONTINUOUS".
Will be fixed in next iteration.
> - I am a bit puzzled about the verification whether the object should
> be humongous. Shouldn't the test program ask the VM whether a given
> object is humongous or not?
> Currently it seems to me that the test program only checks itself, since
> it on the one hand allocates objects of varying sizes, using
> REGION_SIZE/2 and then in allocateAndCheck again uses this same formula
> to determine that an object is humongous.
> At most the test program seems to verify that
> Helpers.detectByteArrayAllocationOverhead() is correct.
> In this case I would expect a whitebox method to ask the VM whether the
> given object is a humongous object.
There are two asserts in allocateAndCheck:
1. We do some obscure calculations to find out exact byte array's length
we need to allocate largest non-humongous/smallest humongous object.
I think it worth to double-check that we calculated right.
The first check gets real allocation size (using white box method
getObjectSize(Object)) and verifies that allocation was as we expected.
If it's not as we expected it's likely a test bug.
2. The second check uses White box method g1IsHumongous(Object) and
verifies that objects larger that a half of region are humongous and
other object are non-humongous (I believe that is definition for
The first check could be considered redundant but since object layout,
padding etc could be changed in future I think it is worth to do it.
It will allow easily distinguish a test bug from a product bug.
More information about the hotspot-gc-dev