提交 e22bd11b 编写于 作者: Z zhouyx

7173044: MemoryMonitor hangs if getMax method in MemoryUsage object returns -1

Reviewed-by: dholmes, sspitsyn
上级 5f5b98b4
......@@ -122,6 +122,7 @@ public class MemoryMonitor extends JPanel {
private Font font = new Font("Times New Roman", Font.PLAIN, 11);
private int columnInc;
private float usedMem[][];
private float usedMemMax[]; // Used when max pool size is undefined
private int ptNum[];
private int ascent, descent;
private Rectangle graphOutlineRect = new Rectangle();
......@@ -142,6 +143,10 @@ public class MemoryMonitor extends JPanel {
}
});
usedMem = new float[numPools][];
usedMemMax = new float[numPools];
for (int i = 0; i < numPools; i++) {
usedMemMax[i] = 1024f * 1024f ;
}
ptNum = new int[numPools];
}
......@@ -194,6 +199,12 @@ public class MemoryMonitor extends JPanel {
MemoryPoolMXBean mp = mpools.get(npool);
float usedMemory = mp.getUsage().getUsed();
float totalMemory = mp.getUsage().getMax();
if (totalMemory < 0) { // Max is undefined for this pool
if (usedMemory > usedMemMax[npool]) {
usedMemMax[npool] = usedMemory;
}
totalMemory = usedMemMax[npool];
}
// .. Draw allocated and used strings ..
big.setColor(Color.green);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册