hotspot/src/share/vm/memory/allocation.inline.hpp
changeset 41176 ff9f64534cff
parent 40655 9f644073d3a0
child 46619 a3919f5e8d2b
equal deleted inserted replaced
41175:68d3c7c39153 41176:ff9f64534cff
   151   int alignment = os::vm_allocation_granularity();
   151   int alignment = os::vm_allocation_granularity();
   152   return align_size_up(size, alignment);
   152   return align_size_up(size, alignment);
   153 }
   153 }
   154 
   154 
   155 template <class E, MEMFLAGS F>
   155 template <class E, MEMFLAGS F>
       
   156 E* MmapArrayAllocator<E, F>::allocate_or_null(size_t length) {
       
   157   size_t size = size_for(length);
       
   158   int alignment = os::vm_allocation_granularity();
       
   159 
       
   160   char* addr = os::reserve_memory(size, NULL, alignment, F);
       
   161   if (addr == NULL) {
       
   162     return NULL;
       
   163   }
       
   164 
       
   165   if (os::commit_memory(addr, size, !ExecMem, "Allocator (commit)")) {
       
   166     return (E*)addr;
       
   167   } else {
       
   168     os::release_memory(addr, size);
       
   169     return NULL;
       
   170   }
       
   171 }
       
   172 
       
   173 template <class E, MEMFLAGS F>
   156 E* MmapArrayAllocator<E, F>::allocate(size_t length) {
   174 E* MmapArrayAllocator<E, F>::allocate(size_t length) {
   157   size_t size = size_for(length);
   175   size_t size = size_for(length);
   158   int alignment = os::vm_allocation_granularity();
   176   int alignment = os::vm_allocation_granularity();
   159 
   177 
   160   char* addr = os::reserve_memory(size, NULL, alignment, F);
   178   char* addr = os::reserve_memory(size, NULL, alignment, F);