< prev index next >

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

Print this page
rev 11974 : imported patch 8159422-mikael-review

*** 151,160 **** --- 151,178 ---- int alignment = os::vm_allocation_granularity(); return align_size_up(size, alignment); } template <class E, MEMFLAGS F> + E* MmapArrayAllocator<E, F>::allocate_or_null(size_t length) { + size_t size = size_for(length); + int alignment = os::vm_allocation_granularity(); + + char* addr = os::reserve_memory(size, NULL, alignment, F); + if (addr == NULL) { + return NULL; + } + + if (os::commit_memory(addr, size, !ExecMem, "Allocator (commit)")) { + return (E*)addr; + } else { + os::release_memory(addr, size); + return NULL; + } + } + + template <class E, MEMFLAGS F> E* MmapArrayAllocator<E, F>::allocate(size_t length) { size_t size = size_for(length); int alignment = os::vm_allocation_granularity(); char* addr = os::reserve_memory(size, NULL, alignment, F);
< prev index next >