Register now or log in to join your professional community.
1. Make sure resources used for any particular operation are closed in finally block like Connection, Statement, ResultSet.
2. Limitize / reduce the scope of objects.
3. Don't initiate objects in loops unless very much necessary if inevitable then try to use same reference for all objects created in loops.
4. use java.util.Collection implementations wisely i.e. specify inital capacity parameter of constructor wisely.
5. If large data is required to be loaded then go for pagination rather loading complete data once in memory.
6. Free native system resources like AWT frame, files, JNI etc when finished with them. Example: Frame, Dialog, and Graphics classes require that the method dispose() be called on them when they are no longer used, to free up the system resources they reserve.
7. use week References.