dagblog.
← Archive

Java memory hogs, or why too much of anything is bad for you


There’s been an interesting discussion about large computations in Java over the last few days on www.java.cz. It led me to a good newsletter article about memory use in Java, 2001–08–28 The Java Specialists’ Newsletter [Issue 029] — Determining Memory Usage in Java. It also shows how to build an object you can use to measure how much memory your own creations take up.

While we’re on memory, did you know the JVM’s Xrunhprof option lets you monitor CPU and memory use and much more? You can also redirect the output to a file. To get help, use the following.

java -Xrunhprof:help

You can use HAT to analyze the file.

Medium version

Related articles

Related CZ Podcast episodes