If you want to monitor your JVM, you can do so a few different ways. One such way involves creating a small JSP script that you drop in the webapps/ROOT or webapps/your_webapp.
Here’s the snippet:
<%@ page import="java.lang.management.*, java.util.*" %><%
response.setContentType("text/plain");
Iterator iter = ManagementFactory.getMemoryPoolMXBeans().iterator();
while(iter.hasNext()){
MemoryPoolMXBean item = (MemoryPoolMXBean) iter.next();
MemoryUsage mu = item.getUsage();
long used = mu.getUsed();
long committed = mu.getCommitted();
long max = mu.getMax();
%>
MEMORY TYPE: <%=item.getName()%>
Used: <%=used%>
Committed: <%=used%>
Max: <%=max%>
<%}%>
Just save that as a .jsp file and call it via your browser and you’ll get output like this:
MEMORY TYPE: Code Cache
Used: 7371904
Committed: 7371904
Max: 33554432
MEMORY TYPE: Eden Space
Used: 243233648
Committed: 243233648
Max: 715849728
MEMORY TYPE: Survivor Space
Used: 27757968
Committed: 27757968
Max: 89456640
MEMORY TYPE: Tenured Gen
Used: 576330752
Committed: 576330752
Max: 1789591552
MEMORY TYPE: Perm Gen
Used: 44413056
Committed: 44413056
Max: 134217728