[logback-dev] [JIRA] Commented: (LBCLASSIC-172) Use WeakHashMap instead of Hashtable in LoggerContext
Holger Hoffstätte (JIRA)
noreply-jira at qos.ch
Tue Dec 15 13:24:33 CET 2009
[ http://jira.qos.ch/browse/LBCLASSIC-172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=11460#action_11460 ]
Holger Hoffstätte commented on LBCLASSIC-172:
---------------------------------------------
This is a very interesting issue. Not sure if this matters any longer since it's already closed, but:
- WeakHashMap is absolutely *not* like a cache since unused WeakReferences are cleared very aggressively even on minor collections, which happen pretty much all the time. If anything, SoftReferences are the right thing to use for caches that yield to memory pressure. The obvious downside is that this memory pressure is pretty arbitrary (softref pressure is a VM config option) and therefore also guaranteed to be inconvenient for someone, somehow.
- WeakHashMap tries to expunge stale references on every get/put/contains, which will definitely impact logger lookup performance.
> Use WeakHashMap instead of Hashtable in LoggerContext
> -----------------------------------------------------
>
> Key: LBCLASSIC-172
> URL: http://jira.qos.ch/browse/LBCLASSIC-172
> Project: logback-classic
> Issue Type: Bug
> Components: Other
> Affects Versions: 0.9.18
> Reporter: Joern Huxhorn
> Assignee: Logback dev list
> Fix For: unspecified
>
>
> Preventing garbage-collection of unused Loggers is a bad idea.
> The following code should not fail:
> for(int i=0;i<10000000;i++) {
> LoggerFactory.getLogger("Foo."+i).debug("Foo!");
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the logback-dev
mailing list