Skip to content

Commit

Permalink
More improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
rkennke committed Apr 23, 2024
1 parent 266f67d commit fd7cb37
Showing 1 changed file with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@
* @test
* @summary Tests that recursive locking doesn't cause excessive native memory usage
* @library /test/lib
* @run main TestRecursiveMonitorChurn
* @run driver TestRecursiveMonitorChurn
*/
public class TestRecursiveMonitorChurn {
static class Monitor {
volatile int i, j;
public static int i, j;
synchronized void doSomething() {
i++;
doSomethingElse();
Expand All @@ -53,6 +53,7 @@ public static void main(String[] args) throws IOException {
Monitor m = new Monitor();
m.doSomething();
}
System.out.println("i + j = " + (Monitor.i + Monitor.j));
} else {
ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(
"-XX:+UnlockDiagnosticVMOptions",
Expand All @@ -75,7 +76,6 @@ public static void main(String[] args) throws IOException {
// (malloc=20800624 #100003) (at peak)

Pattern pat = Pattern.compile("- *Object Monitors.*reserved=(\\d+), committed=(\\d+).*");
boolean foundLine = false;
for (String line : output.asLines()) {
Matcher m = pat.matcher(line);
if (m.matches()) {
Expand All @@ -85,14 +85,10 @@ public static void main(String[] args) throws IOException {
if (committed > 1000) {
throw new RuntimeException("Allocated too many monitors");
}
foundLine = true;
break;
return;
}
}
if (!foundLine) {
throw new RuntimeException("Did not find expected NMT output");
}

throw new RuntimeException("Did not find expected NMT output");
}
}
}

0 comments on commit fd7cb37

Please sign in to comment.