src/share/vm/memory/allocation.hpp

Print this page
rev 6150 : 8037959: BitMap::resize frees old map before copying memory if !in_resource_area
Summary: Add reallocate functionality to ArrayAllocator and use it from BitMap::resize
Reviewed-by:

@@ -746,10 +746,16 @@
 class ArrayAllocator VALUE_OBJ_CLASS_SPEC {
   char* _addr;
   bool _use_malloc;
   size_t _size;
   bool _free_in_destructor;
+
+  static bool should_use_malloc(size_t size) {
+    return size < ArrayAllocatorMallocLimit;
+  }
+
+  static char* allocate_inner(size_t& size, bool& use_malloc);
  public:
   ArrayAllocator(bool free_in_destructor = true) :
     _addr(NULL), _use_malloc(false), _size(0), _free_in_destructor(free_in_destructor) { }
 
   ~ArrayAllocator() {

@@ -757,9 +763,10 @@
       free();
     }
   }
 
   E* allocate(size_t length);
+  E* reallocate(size_t new_length);
   void free();
 };
 
 #endif // SHARE_VM_MEMORY_ALLOCATION_HPP