Mon, 23 Mar 2020 17:57:13 +0000
8231779: crash HeapWord*ParallelScavengeHeap::failed_mem_allocate
Reviewed-by: dlong, tschatzl, pliden
src/share/vm/memory/threadLocalAllocBuffer.cpp | file | annotate | diff | comparison | revisions |
1.1 --- a/src/share/vm/memory/threadLocalAllocBuffer.cpp Wed Jul 29 09:43:43 2020 +0200 1.2 +++ b/src/share/vm/memory/threadLocalAllocBuffer.cpp Mon Mar 23 17:57:13 2020 +0000 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -88,7 +88,8 @@ 1.11 // The result can be larger than 1.0 due to direct to old allocations. 1.12 // These allocations should ideally not be counted but since it is not possible 1.13 // to filter them out here we just cap the fraction to be at most 1.0. 1.14 - double alloc_frac = MIN2(1.0, (double) allocated_since_last_gc / used); 1.15 + // Keep alloc_frac as float and not double to avoid the double to float conversion 1.16 + float alloc_frac = MIN2(1.0f, allocated_since_last_gc / (float) used); 1.17 _allocation_fraction.sample(alloc_frac); 1.18 } 1.19 global_stats()->update_allocating_threads(); 1.20 @@ -205,7 +206,8 @@ 1.21 // this thread is redone in startup_initialization below. 1.22 if (Universe::heap() != NULL) { 1.23 size_t capacity = Universe::heap()->tlab_capacity(myThread()) / HeapWordSize; 1.24 - double alloc_frac = desired_size() * target_refills() / (double) capacity; 1.25 + // Keep alloc_frac as float and not double to avoid the double to float conversion 1.26 + float alloc_frac = desired_size() * target_refills() / (float) capacity; 1.27 _allocation_fraction.sample(alloc_frac); 1.28 } 1.29