|
1 | 1 | /*
|
2 |
| - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 2018, 2020 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
|
@@ -66,7 +66,19 @@ public static void main(String[] args) throws Exception {
|
66 | 66 | static void test(String type) throws Exception {
|
67 | 67 | String heapdumpFilename = type + ".hprof";
|
68 | 68 | ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+HeapDumpOnOutOfMemoryError",
|
69 |
| - "-XX:HeapDumpPath=" + heapdumpFilename, "-XX:MaxMetaspaceSize=64m", |
| 69 | + "-XX:HeapDumpPath=" + heapdumpFilename, |
| 70 | + // Note: When trying to provoke a metaspace OOM we may generate a lot of classes. In debug VMs this |
| 71 | + // can cause considerable wait times since: |
| 72 | + // - Compiler Dependencies verification iterates the class tree |
| 73 | + // - Before exit, the CLDG is checked. |
| 74 | + // Both verifications show quadratic time or worse wrt to number of loaded classes. Therefore it |
| 75 | + // makes sense to switch one or both off and limit the metaspace size to something sensible. |
| 76 | + // Example numbers on a slow ppc64 machine: |
| 77 | + // MaxMetaspaceSize=64M - ~60-70K classes - ~20min runtime with all verifications |
| 78 | + // MaxMetaspaceSize=16M - ~12-15K classes - ~12sec runtime with all verifications |
| 79 | + // MaxMetaspaceSize=16M - ~12-15K classes - VerifyDependencies off - ~3seconds on ppc |
| 80 | + "-XX:MaxMetaspaceSize=16m", |
| 81 | + "-XX:-VerifyDependencies", |
70 | 82 | TestHeapDumpOnOutOfMemoryError.class.getName(), type);
|
71 | 83 |
|
72 | 84 | OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
|
0 commit comments