Total Pageviews


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.

No comments: