How to find out how much memory machine has.
posted 15 years ago
However, these only tell you how much memory the JVM currently has allocated to it, and how much of that is free. Typically as your program grows bigger, the JVM will receive more allocation, up to some maximum. I don't know a platform-independent way of accessing info about the overall memory and load, outside of the JVM. You may need to use Runtime.exec() to query the OS directly.