mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2025-12-06 09:29:38 +01:00
8308766: TLAB initialization may cause div by zero
Reviewed-by: shade, ayang
This commit is contained in:
@@ -213,9 +213,11 @@ void ThreadLocalAllocBuffer::initialize() {
|
||||
set_desired_size(initial_desired_size());
|
||||
|
||||
size_t capacity = Universe::heap()->tlab_capacity(thread()) / HeapWordSize;
|
||||
// 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);
|
||||
if (capacity > 0) {
|
||||
// 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());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user