mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-01 11:40:33 +00:00
8086117: java/lang/Runtime/exec/LotsOfOutput.java still fails intermittently with Process consumes memory
Reviewed-by: chegar
This commit is contained in:
parent
0561e64cb1
commit
8979cb0b2d
@ -48,20 +48,21 @@ public class LotsOfOutput {
|
||||
UnixCommands.ensureCommandsAvailable("cat");
|
||||
|
||||
Process p = runtime.exec(UnixCommands.cat() + " /dev/zero");
|
||||
long initMemory = usedMemory();
|
||||
boolean growing = false;
|
||||
long prev = usedMemory();
|
||||
int growing = 0;
|
||||
for (int i = 1; i < 10; i++) {
|
||||
Thread.sleep(100);
|
||||
long used = usedMemory();
|
||||
if (used != initMemory) {
|
||||
System.out.printf("consuming memory: i: %d, initial: %d, used: %d, delta: %d%n",
|
||||
i, initMemory, used, used - initMemory);
|
||||
if (used != prev) {
|
||||
System.out.printf("consuming memory: i: %d, prev: %d, used: %d, delta: %d%n",
|
||||
i, prev, used, used - prev);
|
||||
}
|
||||
if (used > initMemory + THRESHOLD)
|
||||
growing = true;
|
||||
if (used > prev + THRESHOLD)
|
||||
growing += 1;
|
||||
prev = used;
|
||||
}
|
||||
if (growing)
|
||||
throw new Exception("Process consumes memory.");
|
||||
if (growing > 2)
|
||||
throw new Exception("Process consumes memory: growing " + growing);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user