< prev index next >

src/share/vm/memory/allocation.inline.hpp

Print this page
rev 10388 : imported patch fixAA

@@ -161,10 +161,15 @@
   int alignment = os::vm_allocation_granularity();
   return align_size_up(size, alignment);
 }
 
 template <class E, MEMFLAGS F>
+bool ArrayAllocator<E, F>::should_use_malloc(size_t length) {
+  return size_for_malloc(length) < ArrayAllocatorMallocLimit;
+}
+
+template <class E, MEMFLAGS F>
 E* ArrayAllocator<E, F>::allocate_malloc(size_t length) {
   return (E*)AllocateHeap(size_for_malloc(length), F);
 }
 
 template <class E, MEMFLAGS F>

@@ -213,17 +218,18 @@
   FreeHeap(addr);
 }
 
 template<class E, MEMFLAGS F>
 void ArrayAllocator<E, F>::free_mmap(E* addr, size_t length) {
-  os::release_memory((char*)addr, size_for_mmap(length));
+  bool result = os::release_memory((char*)addr, size_for_mmap(length));
+  assert(result, "Failed to release memory");
 }
 
 template<class E, MEMFLAGS F>
 void ArrayAllocator<E, F>::free(E* addr, size_t length) {
   if (addr != NULL) {
-    if (should_use_malloc(size_for_malloc(length))) {
+    if (should_use_malloc(length)) {
       free_malloc(addr, length);
     } else {
       free_mmap(addr, length);
     }
   }
< prev index next >