954,518 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Memory Leaks in Java

How to find memory leaks in java?
And preventive methods advisable?

argopal
Newbie Poster
1 post since Dec 2007
Reputation Points: 10
Solved Threads: 0
 

Its quite hard to make memory leaks in java, having said that I've done it by leaving active connections open.

The try { } catch{} {finally} blocks help in preventing such a case from arrising.

The try block allows the code to throw exceptions - in the exception were plausable any variables that were created within the try should be set to NULL to allow the garbage collector to release the memory back to the JVM.

The finally block allows executes no matter what happend in the try block.

Hope this helps.

Acidburn
Posting Pro
511 posts since Dec 2004
Reputation Points: 12
Solved Threads: 5
 

As acid burn said, java does not suffer from memory leaks the same as a procedural based language (like C0. The JVM 'disposes' memory leaks as it is shut down.

majestic0110
Nearly a Posting Virtuoso
1,328 posts since Oct 2007
Reputation Points: 256
Solved Threads: 72
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You