I have a fairly small memory leak in a servlet (Tomcat 6.0) running on a
Windows 2003 server. I have been looking into memory profiling to help me
find the leak but nothing seems to be or do what I need. Simply put I want a
list of all of the objects/primitives (and if possible their values) that
are in memory. It would be really nice if I didn't have to bring Tomcat down
at all to do this analysis as the servlet is running in a production
environment. Does anyone know of a decent free tool that does such a thing?
If not, what would be a good route to take to find this leak?

Thanks a ton.
I just finished debugging a major memory leak in my servlet application. Try running the tool "jmap" that comes with java. It works great with Tomcat - just find the PID of the Tomcat (java) instance and run it on that.

For example, fire up Windows Task Manager, go to Applications and find Tomcat. Right-click and choose "go to process". This will move you to the Process pane highlighting the Tomcat (java) process ID.

Now open a command (console) window and (assuming you have Java paths set correctly), type:

jmap -histo PID >output.txt

(or >> output.txt - although I used sequentially numbered output files)

This will capture the stack info into a file for analysis. The PID is the process ID you noted from the Task Manager. If you run this just after you start Tomcat, then a few times after doing the things that you suspect trigger the memory leak, you should see objects in the map that you can identify as not getting released and thus zero in on the leak.

Cheers,

-Richard

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to