Is there a way to avoid undeployment memory leaks in Tomcat?

If you want to make sure not to cause leaks you have to do the following:

  • Make sure your web application does not use any java classes that are in the web container shared libraries. If you have any shared libraries, make sure there is no strong references to the objects in those libraries
  • Avoid using static variables, especially on java objects like HashTable, Sets, etc. If you need to, make sure that you call remove to release the objects with the maps, lists…

Here is also a good article on ThreadLocal and MemoryLeaks – http://blog.arendsen.net/index.php/2005/02/22/threadlocals-and-memory-leaks-revisited/

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)