I'm part of a team of web developers that is developing a servlet/JSP based dynamic website.
We are finding that over time, our JVM becomes hopelessly thrashed and we suspect a memory leak.
Basically the website runs quite fine for about an hour under moderate load, and maybe less time for heavier loads. A server restart every hour (thankfully it only takes 5 seconds), is our Quicker-quick-fix.
But now we are really beginning to wonder how to track down the resource hog.
Does there exist a 'gotcha' list that we could consult along the lines of: "Have you ever created objects and stuck them into Hashtables, only to find...." That we can go through and do a 'code review' of our JSP/Servlets ?
At this point, we are not in the position to buy any sort of tools like JProbe or the like. We are mainly looking for 'common mistakes' that can cause a memory leak.
p.s. - The reason this is not in the Servlet and/or JSP forum, is because I'm sure memory leaks are common to all Java programming paradigms, and not limited to servlet/jsp programming. [This message has been edited by Mike Curwen (edited December 13, 2001).]
Mike- My best suggestion is to use a program like JProbe on your project, we've used it many times to track down memory leak problems (coming sometimes from the Web Application, and sometimes from our App Server). One of the major leaks we were experiencing was traced to this bug http://developer.java.sun.com/developer/bugParade/bugs/4414045.html in the JDK. Nonetheless, I think a program like JProbe could definately be benificial. ------------------ - Jessica Bradley HP Bluestone
Both JProbe and OptimizeIt have free trial versions. I think OptimizeIt was for 2 weeks. With most software, if you need more time, you can usually just ask for another 2 week license. I say try to use it. You can pick it up in hours. If it solves your problem, and your company can't justify a single license fee, I'd leave. (Think about how many hundreds, if not thousands of dollars are being wasted tracking it down now. Figure a developer costs the company $50-100/hour, so a 1 hour code review of 5 developers costs a couple hundred dollars.) Aside from that, I'd look into graphics (image files) and threads. Although I'm not sure of the best way to track them down. --Mark