Get your CodeRanch badge!*
The moose likes Java in General and the fly likes handling Memory leakage Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "handling Memory leakage" Watch "handling Memory leakage" New topic
Author

handling Memory leakage

Harish Tiruvile
Ranch Hand

Joined: Dec 01, 2005
Posts: 99
Hi,

I read in java memory leakage happens .So can any one tell me how to handle memory leak in java .

I know we cannot force garbage collector ,but still, is there any way to handle memory leake by knowing JVM architecture.I mean by getting control over JVM (from java application) ,can i handle memory leakage?

Can any one please let me know the ways used by real-world applications to overcome memory lekage problem.
[ May 03, 2007: Message edited by: harish thrivile ]

Giving up is the easiest thing in the world to do..but holding it together when everything seems like falling apart is true strength!!
with regards, Harish.T
Nitesh Kant
Bartender

Joined: Feb 25, 2007
Posts: 1638

If you want to learn about how GC works and how to tune it, this article will give you some insight.
That will tell you how to tune your JVM according to the kind of objects created by your application. However, the basic idea is to remove all references to a created object as soon as you are done with it. The GC (if tuned properly) will take care of the rest.
Also, this article tells about different kind of references available with java. Probably, that will help you too.
[ May 03, 2007: Message edited by: Nitesh Kant ]

apigee, a better way to API!
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39544
    
  27
Memory can be leaked in two cases: a bug in the JVM, or a bug in the application code. In the former case, you should file a bug report with Sun, in the latter case, fix the bug in the code.

You don't need to force the JVM to run the GC; it will do so automatically if it needs to.


Ping & DNS - updated with new look and Ping home screen widget
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: handling Memory leakage
 
Similar Threads
How can I found which class and method has memory leakage?
Memory Leakage
here are some interview questions asked?any one kindly reply to these quesitons??
Jdbc Odbc Bridge Driver
Memory Management