What is the best way to work out the current PermGen usage in a Grails app?
I’m trying to do some graphing of
Runtime.getRuntime().freeMemory();
Runtime.getRuntime().totalMemory();
And I’d like to also measure the free PermGen space. Most of the search engine + Stack Overflow results on this matter are on handling the PermGenOutOfMemory-like errors, I’d just like to access the stats on these.
Just connect to it using JConsole or VisualVM. Theres no way for you to programmatically determine the PermGen size in your application. You can use the MemoryMXBean to do simple memory reporting, but stick to using the tools I mentioned to get a more detailed picture.