Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

A memory leak occurs when undeploying/redeploying a webapp that uses Commons Logging. How do I fix this?

0
Posted

A memory leak occurs when undeploying/redeploying a webapp that uses Commons Logging. How do I fix this?

0

When commons-logging is deployed in a “shared” classloader that is visible to all webapps, commons-logging still ensures that each webapp gets its own logging configuration by setting up a separate LogFactory object for each context classloader, and ensuring that the correct LogFactory object is used based on the context classloader set whenever LogFactory.getLog is called. However the negative side of this is that LogFactory needs to keep a static map of LogFactory objects keyed by context classloader; when the webapp is “undeployed” this means there is still a reference to the undeployed classloader preventing the memory used by all its classes from being reclaimed. The commons-logging-optional.jar optional code provided with commons-logging 1.0.5 attempted to address this issue using weak references, but this approach cannot solve the issue in many cases.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.