author | duke |
Wed, 05 Jul 2017 19:16:31 +0200 | |
changeset 20626 | ad67c34f79c2 |
parent 17324 | a1518aa0678c |
permissions | -rw-r--r-- |
17324
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
1 |
/* |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
2 |
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
4 |
* |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
8 |
* |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
13 |
* accompanied this code). |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
14 |
* |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
18 |
* |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
21 |
* questions. |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
22 |
*/ |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
23 |
|
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
24 |
/** |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
25 |
* @test CheckAllocateAndSystemGC |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
26 |
* @summary CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456 |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
27 |
* @bug 8013032 |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
28 |
* @key gc |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
29 |
* @key regression |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
30 |
* @library /testlibrary |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
31 |
* @run main/othervm CheckAllocateAndSystemGC |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
32 |
* @author jon.masamitsu@oracle.com |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
33 |
*/ |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
34 |
|
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
35 |
import com.oracle.java.testlibrary.*; |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
36 |
|
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
37 |
public class CheckAllocateAndSystemGC { |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
38 |
public static void main(String args[]) throws Exception { |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
39 |
|
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
40 |
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
41 |
"-showversion", |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
42 |
"-XX:+UseConcMarkSweepGC", |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
43 |
"-Xmn4m", |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
44 |
"-XX:MaxTenuringThreshold=1", |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
45 |
"-XX:-UseCMSCompactAtFullCollection", |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
46 |
"CheckAllocateAndSystemGC$AllocateAndSystemGC" |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
47 |
); |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
48 |
|
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
49 |
OutputAnalyzer output = new OutputAnalyzer(pb.start()); |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
50 |
|
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
51 |
output.shouldNotContain("error"); |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
52 |
|
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
53 |
output.shouldHaveExitValue(0); |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
54 |
} |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
55 |
static class AllocateAndSystemGC { |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
56 |
public static void main(String [] args) { |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
57 |
Integer x[] = new Integer [1000]; |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
58 |
// Allocate enough objects to cause a minor collection. |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
59 |
// These allocations suffice for a 4m young geneneration. |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
60 |
for (int i = 0; i < 100; i++) { |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
61 |
Integer y[] = new Integer[10000]; |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
62 |
} |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
63 |
System.gc(); |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
64 |
} |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
65 |
} |
a1518aa0678c
8013032: CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
jmasa
parents:
diff
changeset
|
66 |
} |