1848281 Members
6373 Online
104023 Solutions
New Discussion

java memory leak problem

 
허영
New Member

java memory leak problem

my team developed a java application using socket for ftp function.
and we found it has severe memory leak after monitoring HPjtune and HPjmeter.

still trying to find which part is wrong but the source code looked alright.

most of the cases, we usually don't think about memory leak about java, because garbage-collector does manage memory and there's no way to remove instances in java source code(like 'delete ..' in C++).

i want to know which case brings memory leak when we writes java source code.

thank you,
2 REPLIES 2
Peter Godron
Honored Contributor

Re: java memory leak problem

Hi,
were do you want to start ? ;-)

Have a read of some of the stuff returned by:
http://www.google.co.uk/search?hl=en&q=memory+leak++JAVA&meta=

A simple start is to first concentrate on areas of that that are repeatetly executed.

Please also read:
http://forums1.itrc.hp.com/service/forums/helptips.do?#33 on how to reward any useful answers given to your questions.

rakeshjogi
New Member

Re: java memory leak problem

Java has automatic garbage collection, which essentially clears unwanted objects from the application. This garbage collection will only free up objects that are no longer referenced or are not reachable. When objects that are no longer needed still reference other objects, the garbage collector will not recognize these objects as unwanted ones, and this will not help in reclaiming the memory.  If this persists, it will slowly lead to a memory leak. In socket-based Java applications, such as those implementing FTP functionality, memory leaks can be caused by several actions, including when static fields hold references, when caches continue to grow indefinitely, or when objects are registered but never removed after actions are performed. Over time, these actions result in the accumulation of memory, leading to a slow increase in heap size and ultimately causing performance degradation or an OutOfMemoryError. For a deeper understanding of common signs of a Java memory leak, identifying memory leaks by analyzing a heap dump, check out this blog,  From Symptoms to Solutions: Troubleshooting Java Memory Leaks & OutOfMemoryError.