Skip to content

Commit 027ef1c

Browse files
committed
Out of virtual memory bugfix
1 parent e2d7779 commit 027ef1c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/hotspot/share/gc/z/zPageAllocator.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -857,8 +857,9 @@ void ZPageAllocator::harvest_claimed_physical(ZPageAllocation* allocation) {
857857
bool ZPageAllocator::is_alloc_satisfied(ZPageAllocation* allocation) const {
858858
// The allocation is immediately satisfied if the list of mappings contains
859859
// exactly one mapping and is of the correct size.
860+
860861
if (allocation->claimed_mappings()->length() != 1) {
861-
// Not a contiguous mapping
862+
// No mapping(s) or not a contiguous mapping
862863
return false;
863864
}
864865

@@ -880,8 +881,10 @@ bool ZPageAllocator::claim_virtual_memory(ZPageAllocation* allocation) {
880881
} else {
881882
// If we have not harvested anything, we only increased capacity. Allocate
882883
// new virtual memory from the manager.
883-
ZMemoryRange vmem = _virtual.alloc(allocation->size(), allocation->numa_id(), true /* force_low_address */);
884-
allocation->claimed_mappings()->append(vmem);
884+
const ZMemoryRange vmem = _virtual.alloc(allocation->size(), allocation->numa_id(), true /* force_low_address */);
885+
if (!vmem.is_null()) {
886+
allocation->claimed_mappings()->append(vmem);
887+
}
885888
}
886889

887890
// If the virtual memory covers the allocation request, we're done.

0 commit comments

Comments
 (0)