-
Enhancement
-
Resolution: Fixed
-
P4
-
7
-
b43
-
x86
-
windows_7
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8018970 | 7u45 | Sean Chou | P4 | Closed | Fixed | b01 |
JDK-2230234 | 7u40 | Sean Coffey | P4 | Closed | Fixed | b01 |
A DESCRIPTION OF THE REQUEST :
In MemoryMonitor.java: plotMemoryUsage method.
This piece of code "
MemoryPoolMXBean mp = mpools.get(npool);
float usedMemory = mp.getUsage().getUsed();
float totalMemory = mp.getUsage().getMax(); "
is followed by
"
// .. Memory Free ..
big.setColor(mfColor);
int MemUsage = (int) (((totalMemory - usedMemory) / totalMemory) * 10);
int i = 0;
for ( ; i < MemUsage ; i++) {
mfRect.setRect(x1+5,(float) y1+ssH+i*blockHeight,
blockWidth, blockHeight-1);
big.fill(mfRect);
}
"
If totalMemory is -1, MemUsage will become a very large value, and the demo hangs in the loop.
In order to reproduce the problem, another jdk other than ri is required because these beans are jdk dependent. It can be reproduced using ibm jdk to run the MemoryMonitor demo.
JUSTIFICATION :
Spec says it is allowed for MemoryUsage.getMax to return -1 if the maximum memory size is undefined.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The demo is still working when MemoryUsage.getMax returns -1 .
ACTUAL -
The demo hangs.
In MemoryMonitor.java: plotMemoryUsage method.
This piece of code "
MemoryPoolMXBean mp = mpools.get(npool);
float usedMemory = mp.getUsage().getUsed();
float totalMemory = mp.getUsage().getMax(); "
is followed by
"
// .. Memory Free ..
big.setColor(mfColor);
int MemUsage = (int) (((totalMemory - usedMemory) / totalMemory) * 10);
int i = 0;
for ( ; i < MemUsage ; i++) {
mfRect.setRect(x1+5,(float) y1+ssH+i*blockHeight,
blockWidth, blockHeight-1);
big.fill(mfRect);
}
"
If totalMemory is -1, MemUsage will become a very large value, and the demo hangs in the loop.
In order to reproduce the problem, another jdk other than ri is required because these beans are jdk dependent. It can be reproduced using ibm jdk to run the MemoryMonitor demo.
JUSTIFICATION :
Spec says it is allowed for MemoryUsage.getMax to return -1 if the maximum memory size is undefined.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The demo is still working when MemoryUsage.getMax returns -1 .
ACTUAL -
The demo hangs.
- backported by
-
JDK-2230234 Memory monitor demo hangs the system if MemoryUsage obj returns -1 .
-
- Closed
-
-
JDK-8018970 Memory monitor demo hangs the system if MemoryUsage obj returns -1 .
-
- Closed
-