Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-2135

IndexReader.close should forcefully evict entries from FieldCache

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.9.3, 3.0.2, 3.1, 4.0-ALPHA
    • core/index
    • None
    • New

    Description

      Spinoff of java-user thread "heap memory issues when sorting by a string field".

      We rely on WeakHashMap to hold our FieldCache, keyed by reader. But this lacks immediacy on releasing the reference, after a reader is closed.

      WeakHashMap can't free the key until the reader is no longer referenced by the app. And, apparently, WeakHashMap has a further impl detail that requires invoking one of its methods for it to notice that a key has just become only weakly reachable.

      To fix this, I think on IR.close we should evict entries from the FieldCache, as long as the sub-readers are truly closed (refCount dropped to 0).

      Attachments

        1. LUCENE-2135.patch
          11 kB
          Michael McCandless
        2. LUCENE-2135.patch
          11 kB
          Michael McCandless
        3. LUCENE-2135.patch
          6 kB
          Michael McCandless

        Issue Links

          Activity

            People

              mikemccand Michael McCandless
              mikemccand Michael McCandless
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: