Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

handling Memory leakage

 
Harish Tiruvile
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic