author | sangheki |
Thu, 10 Aug 2017 18:09:19 -0700 | |
changeset 46795 | 623a5e42deb6 |
parent 40886 | 98cb935dc074 |
permissions | -rw-r--r-- |
34291
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
1 |
/* |
40631
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
38152
diff
changeset
|
2 |
* Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. |
34291
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
4 |
* |
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
8 |
* |
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
13 |
* accompanied this code). |
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
14 |
* |
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
18 |
* |
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
21 |
* questions. |
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
22 |
*/ |
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
23 |
|
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
24 |
/* |
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
25 |
* @test TestHumongousAllocNearlyFullRegion |
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
26 |
* @bug 8143587 |
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
27 |
* @summary G1: humongous object allocations should work even when there is |
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
28 |
* not enough space in the heapRegion to fit a filler object. |
40886 | 29 |
* @requires vm.gc.G1 |
38152
80e5da81fb2c
8154258: [TESTBUG] Various serviceability tests fail compilation
dsamersoff
parents:
35061
diff
changeset
|
30 |
* @modules java.base/jdk.internal.misc |
40631
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
38152
diff
changeset
|
31 |
* @library /test/lib |
34291
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
32 |
* @run driver TestHumongousAllocNearlyFullRegion |
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
33 |
*/ |
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
34 |
|
40631
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
38152
diff
changeset
|
35 |
import jdk.test.lib.process.OutputAnalyzer; |
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
38152
diff
changeset
|
36 |
import jdk.test.lib.process.ProcessTools; |
34291
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
37 |
|
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
38 |
public class TestHumongousAllocNearlyFullRegion { |
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
39 |
// Heap sizes < 224 MB are increased to 224 MB if vm_page_size == 64K to |
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
40 |
// fulfill alignment constraints. |
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
41 |
private static final int heapSize = 224; // MB |
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
42 |
private static final int heapRegionSize = 1; // MB |
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
43 |
|
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
44 |
public static void main(String[] args) throws Exception { |
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
45 |
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( |
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
46 |
"-XX:+UseG1GC", |
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
47 |
"-Xms" + heapSize + "m", |
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
48 |
"-Xmx" + heapSize + "m", |
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
49 |
"-XX:G1HeapRegionSize=" + heapRegionSize + "m", |
35061 | 50 |
"-Xlog:gc", |
34291
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
51 |
HumongousObjectAllocator.class.getName()); |
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
52 |
|
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
53 |
OutputAnalyzer output = new OutputAnalyzer(pb.start()); |
35061 | 54 |
output.shouldContain("Pause Initial Mark (G1 Humongous Allocation)"); |
34291
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
55 |
output.shouldHaveExitValue(0); |
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
56 |
} |
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
57 |
|
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
58 |
static class HumongousObjectAllocator { |
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
59 |
public static void main(String [] args) { |
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
60 |
for (int i = 0; i < heapSize; i++) { |
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
61 |
// 131069 is the number of longs it takes to fill a heapRegion except |
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
62 |
// for 8 bytes on 64 bit. |
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
63 |
long[] largeObect = new long[131069]; |
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
64 |
} |
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
65 |
} |
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
66 |
} |
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
67 |
} |
8ad97a2bc8e7
8143587: G1 crashes with humongous object of size that almost fills a heap region
david
parents:
diff
changeset
|
68 |