My tomcat web application seems to use a lot of memory sometimes, to the point that the RedHat Linux machine becomes unreachable. Yes, I am making some assumptions. Since I have not been able to connect to the machine when this occurs, I cannot do a "top" to confirm my theory. I just know that since the last time this occurred, the CPU usage has been reasonable, and the memory usage has been around an average of 50% per day( as an average of checking "top" every 15 minutes between 6 am and 11:45 pm ). On some busy days, it spiked to almost to 70% ( as an average for that day ).
So, based on the above assumptions, I think my webapp has some memory leaks and issues. I am trying to use netbeans to find this problem, and various profilers I have found online, but it has been an uphill battle as the tools have not worked as I would expect ( this is a separate issue ). Right now, increasing memory is not an option. So, can anyone think of any other ideas for finding memory leaks. I suppose I could scatter some calls to "java.lang.Runtime.getRuntime().freeMemory();" and "java.lang.Runtime.getRuntime().totalMemory();" and run the GC when it gets above some threshold. Just wondering if I am missing some other, better ideas.
Some version information:
1. Tomcat version: Apache Tomcat/6.0.18
2. JVM Version:
a. Production: 1.6.0_13-b03
b. Development: 1.5.0-b64
3. Linux version:
a. Production: 2.6.18-128.el5, i386
b. Development: 2.4.20-8smp, i386
Tell me if you need more information. Thanks so much.
Sometimes the Manager app "comes with Tomcat", sometimes you have to install it separately. I think it's a separate download for Tomcat6. But it's definitely helpful. Another utility that's worth firing up is the jconsole program that comes with the JDK.
Since the JVM has a lot of shared memory it can sometimes be difficult to determine which app is soaking it all up. You may also find it useful to emply the JVM's memory snapshot function to capture actual low-level memory use information.
An IDE is no substitute for an Intelligent Developer.
Joined: Feb 18, 2006
Yes, I have tried jconsole and visualVM, but neither can connect to tomcat JMX stuff. eventhough I have followed the directions exactly. I am going to start another thread on that issue, as it is sort of a separate issue.
Now, let me make sure we are on the same page with regards to "manager". The only I am looking it is pictured in the screenshot I attached. Is that what you mean? I clicked on "Server Status" to find some information, but it is not really that helpful.