lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <>
Subject Re: ThreadLocal leak (was Re: Leaking org.apache.lucene.index.* objects)
Date Tue, 19 Dec 2006 19:50:07 GMT

: Can anyone else have a look at the patch for LUCENE-651 (or just at
: FieldCacheImpl) and see if there is a quick fix?

If i'm not mistaken, isn't line #65 wrong? ...

      synchronized (readerCache) {
        innerCache = (Map) readerCache.get(reader);
        if (innerCache == null) {
          innerCache = new HashMap();
          readerCache.put(reader, innerCache);
          value = null;
        } else {
          value = innerCache.get(key);
        if (value == null) {
          value = new CreationPlaceholder();
          innerCache.put(reader, value);          <--- L65

...why is the reader being used as the key of the innerCache? Shouldn't
the "key" (param) be used here? ... nothing seems to ever remove the
reader from the innerCache, so i don't see how the WeekHashMap readerCache
would ever let go of it either.

: Also, wouldn't it be better if IndexReaders had a reference to their
: copy FieldCache, which they can kill when they are closed?  What we have
: now is a chunky FieldCacheImpl that has references to IndexReaders, and
: doesn't know when they are closed, and thus it can't remove them and
: their data from its internal caches?

as i recall, we've discussed that on the mailing list as being a "better
API" for dealing with FieldCaches ... but it would be an API changes, and
no one has (as of yet) attempted it and submitted a patch.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message