8145061: Too many instances of java.lang.Boolean created in Java application (hotspot repo)
Summary: Avoid creating unused instances of Long and Boolean
Reviewed-by: dholmes, sla
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java Thu Dec 10 15:27:16 2015 +0100
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java Thu Dec 10 17:48:44 2015 +0100
@@ -229,17 +229,17 @@
public String getValue() {
if (isBool()) {
- return new Boolean(getBool()).toString();
+ return Boolean.toString(getBool());
} else if (isInt()) {
- return new Long(getInt()).toString();
+ return Long.toString(getInt());
} else if (isUInt()) {
- return new Long(getUInt()).toString();
+ return Long.toString(getUInt());
} else if (isIntx()) {
- return new Long(getIntx()).toString();
+ return Long.toString(getIntx());
} else if (isUIntx()) {
- return new Long(getUIntx()).toString();
+ return Long.toString(getUIntx());
} else if (isSizet()) {
- return new Long(getSizet()).toString();
+ return Long.toString(getSizet());
} else {
return null;
}