Setup steps:
https://github.com/jbellis/jamm
To use MemoryMeter, start the JVM with "-javaagent:<jar
path>/jamm.jar"
For example:
@Override
public String toString() {
MemoryMeter meter = new MemoryMeter();
return “MessureDeep:” + meter.measureDeep(hashMap)
public String toString() {
MemoryMeter meter = new MemoryMeter();
return “MessureDeep:” + meter.measureDeep(hashMap)
}
Output:
MessureDeep =343163544 // output is in bytes
((343163544/1024)/1024) = 327.2662582397461 MB (that
means hashMap is holding 327
MB of data in memory)
No comments:
Post a Comment