{{blog.title}}
{{blog.date}} | {{blog.stars}} stars
Author: Kiran
• Tuesday, February 12, 2008
Java is supposed to be an automatic memory managed environment. Or simply said, you can allocate memory and just forget to dispose it, explicitly. The virtual machine would take care of releasing it – a benign gesture towards a developer who can now afford to be more forgetful (without the fear of causing memory leaks), and hence more productive (?). Ignorance is Bliss!

But, there’s a catch! Of course, the virtual machine is not so smart. It does a fairly reasonable calculation to decide whether to release i.e., when there are no more references to that memory, it can be released. This implies that the memory is not recovered unless you nullify all the references to it.

Further, in case of real-world applications, with thousands of classes, it is highly likely that there might be some unknown stale references that are still lurking around in memory, preventing that memory from being recovered.

In essence, if the developer forgets to release all the references, it will not be reclaimed. It is not at all as benign as it was touted to be, after all. You still cannot afford to be forgetful - You have to nullify all those damn references!!
This entry was posted on Tuesday, February 12, 2008 and is filed under , . You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response , or trackback from your own site.

0 comments :