Skip to content
Permalink
Browse files

8231779: crash HeapWord*ParallelScavengeHeap::failed_mem_allocate

Reviewed-by: dlong, tschatzl, pliden
  • Loading branch information
Poonam Bajaj committed Mar 23, 2020
1 parent 398ce29 commit edb6783a218813b7f54946d957a6536cbd589118
Showing with 5 additions and 3 deletions.
  1. +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());

0 comments on commit edb6783

Please sign in to comment.