About Me

My photo
I know the last digit of PI

Tuesday, April 08, 2014

PermGen space leaks

The causes of PermGen space leaks:
  1. Thread left running after web-app undeployment - the context class loader of the thread is usually the class loader of the web application, so it contains all webapp classes.
  2. Using ThreadLocal with thread created by the web server - web app class is assigned to web server thread (e.g. HTTP worker thread) - the web app class holds a reference to the classloader, even if the web app is undeployed.
  3. Database driver leak - every database driver should register in  java.sql.DriverManager
    the web-app must deregister it from the there, otherwise it hold a reference to the web-app class loader, if the web app is undeploye

No comments: