views:

185

answers:

3

I have a J2EE struts app running on Weblogic 10.3 which has obviously severe memory issues. My company won't buy 3rd party tools like Jprobe so my only option is to use freely available tools. I have enabled gc logs and observed that memory consumption is unusually high triggering frequent gc cycles. Right now I am configuring JAM console/JADE on my machine to capture memory snapshots to see which part of the application is misbehaving. Is there any other better approach to solve this problem. There are many small best practices to improve memory usage but they seem too much work for a old fat legacy app.

Any advice greatly appreciated.

+2  A: 

You can use VisualVM Memory Profiling. VisualVM comes with recent JDK 1.6 versions.

Thomas Jung
Thank you but not able to open the link, maybe its my firewall. Will surely give it a try and post here the result
Ravi Gupta
You don't need to go to the link, just look for the visualvm executable in your JDK's /bin directory (available since JDK 1.6u7 I believe)
Michael Borgwardt
I believe the executable is called `jvisualvm`.
Eli Acherkan
+1  A: 

Just get an open source Java profiler and retest.

I can at least tell that the most common memory-efficiency mistakes in a webapp are abusing the HttpSession as a copy of a datastore and using a byte[totalSize] instead of buffered streams to pipe data from the one to other side. Just closely review the code or have a more experienced developer review the code.

BalusC
Yes, such similar issues do plague my app but we don't have any other developer (I am the last hope of mankind err.. my project). Will go through profiler list to see if any matches my requirement. thanks heaps
Ravi Gupta
+3  A: 

When it comes to heap dump analysis, VisualVM is a nice tool and can be used to resolve memory leaks. But feature-wise, the Eclipse Memory Analyzer (previously known as the SAP Memory Analyzer before it was donated to the Eclipse foundation by SAP) is definitely one step above VisualVM. Seriously, I'm not a big fan of SAP software in general but what they did with this tool is really great and Eclipse MAT is for me the de facto choice for heap dump analysis.

Since I use it, finding greedy memory pigs has never been that easy (and it even has a "leak suspects" detector that works pretty well).

For more details and a methodology, I warmly recommend the mega super awesome blog post How to Fix Memory Leaks in Java. For Eclipse MAT specific resources, have a look at this very light tutorial, the Eclipse Memory Analyzer, 10 useful tips/articles for more advanced tips or the "official" Memory Analyzer Webinar.

Pascal Thivent
Super cool, will try this today.
Ravi Gupta