You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by bu...@apache.org on 2008/08/20 23:53:26 UTC

DO NOT REPLY [Bug 45660] NDC could remove Hashtable entry if Stack gets empty

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





--- Comment #1 from Curt Arnold <ca...@apache.org>  2008-08-20 14:53:26 PST ---
Yes, but it could also radically affect performance if you had a situation
where you repeatedly pushed and popped the only value on the stack.  With the
suggested change that would also involve a hashtable construction and
destruction where it does not currently do that.

If you know that you are at the end of a threads life but don't know if the
thread used NDC, it doesn't hurt to call NDC.remove().  NDC.remove not only
clears the current thread, but does the equivalent of garbage collection on
NDC's left by other threads that may have died.  If you find some way to make
sure that NDC.remove is called occasionally, you should be able to avoid memory
bloat.

Obviously there are a lot better ways to write NDC and MDC with the current
JVM's, but completely rewriting NDC and MDC in a maintenance release is a
little too risky for me and would be better to spend the effort on log4j 2.0. 
log4j 1.3 did rewrite NDC and MDC, but there have been no plans to backport
that to log4j 1.2.x.


-- 
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: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org