What about:

Runtime rt = Runtime.getRuntime();
long free = rt.maxMemory() - (rt.totalMemory - rt.freeMemory());

I've been using this (with Tomcat, not Geronimo), and while it's not perfect it gives you an idea of the JVM memory consumption.

Trygve

2008/8/13 Peter L. Berghold <peter@berghold.net>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Is there a way to programmatically extract from a running Geronimo
instance it's memory usage?  Reason I'm asking is I'd like to write a
Nagios plugin for this to provide alarms when the JVM runs out of memory.


- --

Peter L. Berghold     http://www.berghold.net   peter@berghold.net
Unix Professional     Dog Agility Fan   Crazed Cook
"Those who fail to learn from history are condemned to repeat it."

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIowWOUM9/01RIhaARAn9WAKCN8+CnDcYYEaQZQItt47dRl5QTcACgsWFt
NHjPF+uuKEvxzXI7vHUNNBc=
=5hm6
-----END PGP SIGNATURE-----