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

Kim Barrett kim.barrett at oracle.com
Fri Feb 14 23:05:03 UTC 2020


> On Feb 14, 2020, at 10:05 AM, Thomas Schatzl <thomas.schatzl at oracle.com> 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

------------------------------------------------------------------------------
src/hotspot/share/memory/memRegion.hpp
  96   // Creates and initializes an array of MemRegions of the given length.
  97   static MemRegion* create(uint length, MEMFLAGS flags);

A function named "create" suggests to me creating a single object, not
an array.  Perhaps "make_array" or "create_array" or "new_array"?

------------------------------------------------------------------------------

Other than that, looks good.  I don't need a new webrev for using any
of the suggested names.

I noticed the memory leak in map_heap_data, but see that you filed a
separate bug for that, and already have a reviewed fix for it.



More information about the hotspot-runtime-dev mailing list