< prev index next >
src/share/vm/memory/threadLocalAllocBuffer.cpp
Print this page
rev 11944 : 8231779: crash HeapWord*ParallelScavengeHeap::failed_mem_allocate
Reviewed-by: dlong, tschatzl, pliden
rev 11952 : Merge jdk8u272-b02
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 1999, 2018, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -88,11 +88,12 @@
// _gc_waste is not subtracted because it's included in
// "used".
// 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);
}
global_stats()->update_allocating_threads();
global_stats()->update_number_of_refills(_number_of_refills);
global_stats()->update_allocation(_number_of_refills * desired_size());
@@ -211,11 +212,12 @@
// Following check is needed because at startup the main
// thread is initialized before the heap is. The initialization for
// this thread is redone in startup_initialization below.
if (Universe::heap() != NULL) {
size_t capacity = Universe::heap()->tlab_capacity(myThread()) / 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());
< prev index next >