mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 11:04:34 +02:00
8011661: Insufficient memory message says "malloc" when sometimes it should say "mmap"
Reviewed-by: coleenp, zgu, hseigel
This commit is contained in:
parent
a2f5f4ca1b
commit
0f7adcc3d9
31 changed files with 78 additions and 59 deletions
|
@ -58,7 +58,9 @@ inline char* AllocateHeap(size_t size, MEMFLAGS flags, address pc = 0,
|
|||
#ifdef ASSERT
|
||||
if (PrintMallocFree) trace_heap_malloc(size, "AllocateHeap", p);
|
||||
#endif
|
||||
if (p == NULL && alloc_failmode == AllocFailStrategy::EXIT_OOM) vm_exit_out_of_memory(size, "AllocateHeap");
|
||||
if (p == NULL && alloc_failmode == AllocFailStrategy::EXIT_OOM) {
|
||||
vm_exit_out_of_memory(size, OOM_MALLOC_ERROR, "AllocateHeap");
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
|
@ -68,7 +70,9 @@ inline char* ReallocateHeap(char *old, size_t size, MEMFLAGS flags,
|
|||
#ifdef ASSERT
|
||||
if (PrintMallocFree) trace_heap_malloc(size, "ReallocateHeap", p);
|
||||
#endif
|
||||
if (p == NULL && alloc_failmode == AllocFailStrategy::EXIT_OOM) vm_exit_out_of_memory(size, "ReallocateHeap");
|
||||
if (p == NULL && alloc_failmode == AllocFailStrategy::EXIT_OOM) {
|
||||
vm_exit_out_of_memory(size, OOM_MALLOC_ERROR, "ReallocateHeap");
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
|
@ -130,12 +134,12 @@ E* ArrayAllocator<E, F>::allocate(size_t length) {
|
|||
|
||||
_addr = os::reserve_memory(_size, NULL, alignment);
|
||||
if (_addr == NULL) {
|
||||
vm_exit_out_of_memory(_size, "Allocator (reserve)");
|
||||
vm_exit_out_of_memory(_size, OOM_MMAP_ERROR, "Allocator (reserve)");
|
||||
}
|
||||
|
||||
bool success = os::commit_memory(_addr, _size, false /* executable */);
|
||||
if (!success) {
|
||||
vm_exit_out_of_memory(_size, "Allocator (commit)");
|
||||
vm_exit_out_of_memory(_size, OOM_MMAP_ERROR, "Allocator (commit)");
|
||||
}
|
||||
|
||||
return (E*)_addr;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue