Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8240590

Add MemRegion::destroy_array to complement introduced create_array

XMLWordPrintable

    • gc
    • b16

      From [~stefank]:

      Catching up on mail and found that this was pushed to G1:

       G1CMRootMemRegions::G1CMRootMemRegions(uint const max_regions) :
      - _root_regions(NULL),
      + _root_regions(MemRegion::create_array(max_regions, mtGC)),
      ...
       G1CMRootMemRegions::~G1CMRootMemRegions() {
      - delete[] _root_regions;
      + FREE_C_HEAP_ARRAY(MemRegion, _root_regions);
       }

      I'd like to suggest that we all use "matching" code for creation and deletion.
      Previous version of the patch used NEW_C_HEAP_ARRAY, so it was easy to see that the code matched. If we add a create_array, I'd like to suggest adding a destroy_array function as well.

      That method should also call the destructors then.

            tschatzl Thomas Schatzl
            tschatzl Thomas Schatzl
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: