RFR (S): 8238999: Remove MemRegion custom new/delete operator overloads

Ioi Lam ioi.lam at oracle.com
Fri Feb 14 16:12:37 UTC 2020


Hi Thomas,

Maybe we can fold this into a MemRegion::create(int size) function?

1750   MemRegion* regions = NEW_C_HEAP_ARRAY(MemRegion, max, mtInternal);
1751   for (int i = 0; i < max; i++) {
1752     ::new (&regions[i]) MemRegion();
1753   }

Thanks
- Ioi



On 2/14/20 7:05 AM, Thomas Schatzl wrote:
> Hi all,
>
>   can I have reviews for this small change to the MemRegion class to 
> remove unnecessary new/delete overloads from MemRegion.
>
> They return NULL if there is not enough memory. This is uncommon to do 
> in Hotspot code.
>
> All uses in the code either checks whether the allocation is non-NULL 
> and then terminates the VM, or will just crash too.
>
> It is easier to just replace the new[] calls with NEW_C_HEAP_ARRAY 
> allocations and do the initialization manually.
>
> cc'ing runtime because Coleen added the new operator for working 
> around a Metaspace issue in JDK-8021954 years ago.
>
> CR:
> https://bugs.openjdk.java.net/browse/JDK-8238999
> Webrev:
> http://cr.openjdk.java.net/~tschatzl/8238999/webrev/
> Testing:
> hs-tier1-4
>
> Thanks,
>   Thomas




More information about the hotspot-gc-dev mailing list