Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
8231779: crash HeapWord*ParallelScavengeHeap::failed_mem_allocate
Reviewed-by: dlong, tschatzl, pliden
- Loading branch information
Showing
with
5 additions
and
3 deletions.
-
+5
−3
src/hotspot/share/gc/shared/threadLocalAllocBuffer.cpp
|
|
@@ -1,5 +1,5 @@ |
|
|
/* |
|
|
* Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved. |
|
|
* Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved. |
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
|
* |
|
|
* This code is free software; you can redistribute it and/or modify it |
|
@@ -69,7 +69,8 @@ void ThreadLocalAllocBuffer::accumulate_and_reset_statistics(ThreadLocalAllocSta |
|
|
// The result can be larger than 1.0 due to direct to old allocations. |
|
|
// These allocations should ideally not be counted but since it is not possible |
|
|
// to filter them out here we just cap the fraction to be at most 1.0. |
|
|
double alloc_frac = MIN2(1.0, (double) allocated_since_last_gc / used); |
|
|
// Keep alloc_frac as float and not double to avoid the double to float conversion |
|
|
float alloc_frac = MIN2(1.0f, allocated_since_last_gc / (float) used); |
|
|
_allocation_fraction.sample(alloc_frac); |
|
|
} |
|
|
|
|
@@ -187,7 +188,8 @@ void ThreadLocalAllocBuffer::initialize() { |
|
|
set_desired_size(initial_desired_size()); |
|
|
|
|
|
size_t capacity = Universe::heap()->tlab_capacity(thread()) / HeapWordSize; |
|
|
double alloc_frac = desired_size() * target_refills() / (double) capacity; |
|
|
// Keep alloc_frac as float and not double to avoid the double to float conversion |
|
|
float alloc_frac = desired_size() * target_refills() / (float) capacity; |
|
|
_allocation_fraction.sample(alloc_frac); |
|
|
|
|
|
set_refill_waste_limit(initial_refill_waste_limit()); |
|
|