1 /* |
1 /* |
2 * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
23 |
23 |
24 /* |
24 /* |
25 * @test |
25 * @test |
26 * @summary Stress test for malloc tracking |
26 * @summary Stress test for malloc tracking |
27 * @key nmt jcmd stress |
27 * @key nmt jcmd stress |
28 * @library /testlibrary /test/lib |
28 * @library /test/lib |
29 * @modules java.base/jdk.internal.misc |
29 * @modules java.base/jdk.internal.misc |
30 * java.management |
30 * java.management |
31 * @build MallocStressTest |
31 * @build sun.hotspot.WhiteBox |
32 * @ignore - This test is disabled since it will stress NMT and timeout during normal testing |
32 * @ignore - This test is disabled since it will stress NMT and timeout during normal testing |
33 * @run main ClassFileInstaller sun.hotspot.WhiteBox |
33 * @run main ClassFileInstaller sun.hotspot.WhiteBox |
34 * @run main/othervm/timeout=600 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail MallocStressTest |
34 * @run main/othervm/timeout=600 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail MallocStressTest |
35 */ |
35 */ |
36 |
36 |
37 import java.util.concurrent.atomic.AtomicInteger; |
37 import java.util.concurrent.atomic.AtomicInteger; |
38 import java.util.ArrayList; |
38 import java.util.ArrayList; |
39 import java.util.List; |
39 import java.util.List; |
40 import java.util.Random; |
40 import java.util.Random; |
41 import jdk.test.lib.*; |
41 import jdk.test.lib.JDKToolFinder; |
|
42 import jdk.test.lib.Platform; |
|
43 import jdk.test.lib.process.ProcessTools; |
|
44 import jdk.test.lib.process.OutputAnalyzer; |
42 import sun.hotspot.WhiteBox; |
45 import sun.hotspot.WhiteBox; |
43 |
46 |
44 public class MallocStressTest { |
47 public class MallocStressTest { |
45 private static int K = 1024; |
48 private static int K = 1024; |
46 |
49 |