I'm working in the product based company. In some modules our application is very slow. So we have to monitor in which java files or database connections oriented files are sucking the memory. Is there any tool to identify in which java files are totally sucking this memory ? Can you anybody to help me to identify the issue. Thanks in advance. I'm using IBM RSA 7.5.5 . Is there any plugin to integrate to this IDE ?
-
1Thread dump & heap dump? – kosa Jul 24 '12 at 14:02
-
i want to identify the heap memory usage – Kallar_Mannargudi Jul 24 '12 at 14:02
-
Heap is the one which tells how many objects are there in memory at a particular point of time. – kosa Jul 24 '12 at 14:04
-
Is there any tool to identify the memory issue for the thousands of thousand of java file ? – Kallar_Mannargudi Jul 24 '12 at 14:06
-
Yes, jmap & visualvm are the tools you are looking for. Other tools also available based on features you are looking for. – kosa Jul 24 '12 at 14:07
-
possible duplicate of [General strategy to resolve Java memory leak?](http://stackoverflow.com/questions/1473510/general-strategy-to-resolve-java-memory-leak) – Stephen C Jul 24 '12 at 14:09
2 Answers
Try using VisualVM, it's a free tool that can help you profile your application visually and can break it down to each class. It shows new class instances, different memory segment usages (heapspace, permgen space, etc.) as well as marking garbage collection operations. Java doesn't allow you to manually "free" objects the way C does, but rather, once an object leaves scope it is eventually garbage collected when the garbage collector runs.
If you find that you're ending up with a ton of instances hanging around when you don't expect them to be, then you may have a problem with how you're managing scope or you may be leaving around references to objects that you would otherwise expect to be transient. Garbage collection happens when there are no references to an object and/or that object is out of scope.

- 1,913
- 12
- 22
The Oracle trouble-shooting page includes a large section on analysing memory usage and looking for memory leaks:
And here is a good SO Question on this topic: