Print this page
8236073: G1: Use SoftMaxHeapSize to guide GC heuristics
Split |
Close |
Expand all |
Collapse all |
--- old/src/hotspot/share/gc/g1/g1HeapSizingPolicy.hpp
+++ new/src/hotspot/share/gc/g1/g1HeapSizingPolicy.hpp
1 1 /*
2 2 * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 4 *
5 5 * This code is free software; you can redistribute it and/or modify it
6 6 * under the terms of the GNU General Public License version 2 only, as
7 7 * published by the Free Software Foundation.
8 8 *
9 9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 12 * version 2 for more details (a copy is included in the LICENSE file that
13 13 * accompanied this code).
14 14 *
15 15 * You should have received a copy of the GNU General Public License version
16 16 * 2 along with this work; if not, write to the Free Software Foundation,
17 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 18 *
19 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 20 * or visit www.oracle.com if you need additional information or have any
21 21 * questions.
22 22 *
23 23 */
24 24
25 25 #ifndef SHARE_GC_G1_G1HEAPSIZINGPOLICY_HPP
26 26 #define SHARE_GC_G1_G1HEAPSIZINGPOLICY_HPP
27 27
28 28 #include "memory/allocation.hpp"
29 29
30 30 class G1Analytics;
31 31 class G1CollectedHeap;
32 32
33 33 class G1HeapSizingPolicy: public CHeapObj<mtGC> {
34 34 // MinOverThresholdForGrowth must be less than the number of recorded
35 35 // pause times in G1Analytics, representing the minimum number of pause
36 36 // time ratios that exceed GCTimeRatio before a heap expansion will be triggered.
37 37 const static uint MinOverThresholdForGrowth = 4;
38 38
39 39 const G1CollectedHeap* _g1h;
40 40 const G1Analytics* _analytics;
41 41
42 42 const uint _num_prev_pauses_for_heuristics;
43 43 // Ratio check data for determining if heap growth is necessary.
44 44 uint _ratio_over_threshold_count;
45 45 double _ratio_over_threshold_sum;
46 46 uint _pauses_since_start;
47 47
48 48
49 49 protected:
↓ open down ↓ |
49 lines elided |
↑ open up ↑ |
50 50 G1HeapSizingPolicy(const G1CollectedHeap* g1h, const G1Analytics* analytics);
51 51 public:
52 52
53 53 // If an expansion would be appropriate, because recent GC overhead had
54 54 // exceeded the desired limit, return an amount to expand by.
55 55 virtual size_t expansion_amount();
56 56
57 57 // Clear ratio tracking data used by expansion_amount().
58 58 void clear_ratio_check_data();
59 59
60 + // Check if heap size can be shrinked
61 + bool can_shrink_heap_size_to(size_t heap_size);
62 +
60 63 static G1HeapSizingPolicy* create(const G1CollectedHeap* g1h, const G1Analytics* analytics);
61 64 };
62 65
63 66 #endif // SHARE_GC_G1_G1HEAPSIZINGPOLICY_HPP
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX