https://issues.apache.org/bugzilla/show_bug.cgi?id=50486

           Summary: Memoryleak - org.apache.log4j.helpers.ThreadLocalMap
           Product: Log4j
           Version: 1.2
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Other
        AssignedTo: [email protected]
        ReportedBy: [email protected]


Tomcat 7 log's this when doing a shutdown:

The web application [/MyApp] created a ThreadLocal with key of type
[org.apache.log4j.helpers.ThreadLocalMap] (value
[org.apache.log4j.helpers.threadlocal...@1d3e069]) and a value of type
[java.util.Hashtable] (value [{}]) but failed to remove it when the web
application was stopped. This is very likely to create a memory leak.

I'm using it the following way:

try {
  if (MDC.get(..) == null) {
    MDC.put(.., ...);
  }
   ....
  } finally {
     MDC.remove(...);
  }

After taking a quick look at the source of log4j i think the problem is that
remove only removes the entry from the HashTable but does not call remove on
the ThreadLocal itself.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to