I have some Java code that leaks memory and causes Tomcat to die with an out of memory error once every couple of days. After finding a way to reproduce the problem reliably in a JUnit test outside Tomcat and exhausting the obvious means that I know about to find such problems, I’ve jumped into the world of profilers. I’ve always felt like profilers are a tool that real developers should know how to use, but I’ve never had to use one. (I also feel that way about debuggers. I debugged programs for years with
Anyway, I’m trying out two profilers right now, JProfiler, which provides a 10 day evaluation license and YourKit, which provides a 15 day evaluation. The first thing I figured out is that there’s more to finding memory leaks than running your code in the profiler, or at least there is in this case.
My goal is to find and solve the problem before either evaluation license expires, and to decide whether I need to buy either of these products. I’ll post about my progress here, and welcome any comments with further information on hunting down and killing memory leaks in Java programs.