You can monitor memory usages with JConsole.
The jstat also will help.
grayger
2009-05-08 04:15:19
There are a number of ways to get heap dumps. Here are some I've used:
-XX:+HeapDumpOnOutOfMemoryError
should get you dump if you hit your OOM.If you're running Java 6, jmap should work on Windows. This might be useful if you want to dump the heap and you haven't hit your OOM. Use Windows Task Manager to find the pid of your Java app, and in a console run this:
jmap -dump:format=b,file=c:\heap.bin <pid>
In addition to VisualVM, the Eclipse Memory Analyzer (also free) can help you analyze what's eating up all the space once you've got the dump.