Total Pageviews

2011/12/30

Preventative medicine for Memory leaks in Java


How to avoid memory leaks?

    To avoid memory leaks, We must check our applications to make sure the below:
  • Our app ought to release JDBC ResultSet, Statement, or connections.
  • Our app ought to use a finally block to make sure the objects are released appropriately.
  • Our app ought to release instance or resource objects that are stored in static tables and
  • also perform clean up on serially reusable objects.
    For example, appending an error messages to a Vector defined in a serially reusable object. The app never cleaned the Vector before it was given to the next user. As the object was reused over and over again, error messages accumulated and causes a memory leak that will be difficult to track it down.

http://www.codedairy.com/bestpractices/preventative-medicine-for-memory-leaks-in-java#.TvzFwq_rHJ4.dzone

No comments: