I'm writing a simple memory reporting utility (in this particular situation using an existing tool is not an option). I've got it to print the max, commit and usage for all the memory pools returned by iterating ManagementFactory.getMemoryPoolMXBeans()
. That gets me the three heap generations of heap memory (eden, survivor and old), the permgen, and the "code cache".
None of these appear to be the method stack memory. The closest thing seems be the "code cache", but I've read that that's actually where the hotspotter puts compiled classes.
I ask because I'm trying to track down the cause of a crash in a JBoss webapp that's failing to create a new thread. http://www.mastertheboss.com/jboss-server/jboss-monitoring/how-to-solve-javalangoutofmemoryerror-unable-to-create-new-native-thread suggests that this could be due to running out of stack memory, which stands to reason. The question is: how do I get the stack memory, so I can check?