You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Brian Groose (JIRA)" <ji...@apache.org> on 2009/06/23 17:10:07 UTC

[jira] Created: (LUCENE-1715) DirectoryIndexReader finalize() holding TermInfosReader longer than necessary

DirectoryIndexReader finalize() holding TermInfosReader longer than necessary
-----------------------------------------------------------------------------

                 Key: LUCENE-1715
                 URL: https://issues.apache.org/jira/browse/LUCENE-1715
             Project: Lucene - Java
          Issue Type: Bug
          Components: Index
    Affects Versions: 2.4.1
         Environment: Sun JDK 6 update 12 64-bit, Debian Lenny
            Reporter: Brian Groose


DirectoryIndexReader has a finalize method, which causes the JDK to keep a reference to the object until it can be finalized.  SegmentReader and MultiSegmentReader are subclasses that contain references to, potentially, hundreds of megabytes of cached data in a TermInfosReader.

Some options would be removing finalize() from DirectoryIndexReader (it releases a write lock at the moment) or possibly nulling out references in various close() and doClose() methods throughout the class hierarchy so that the finalizable object doesn't references the Term arrays.

Original mailing list message:
http://mail-archives.apache.org/mod_mbox/lucene-java-user/200906.mbox/%3C7A5CB4A7BBCE0C40B81C5145C326C31301A62971@NUMEVP06.na.imtn.com%3E

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-1715) DirectoryIndexReader finalize() holding TermInfosReader longer than necessary

Posted by "Earwin Burrfoot (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1715?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12723224#action_12723224 ] 

Earwin Burrfoot commented on LUCENE-1715:
-----------------------------------------

I object nulling references in attempt to speed up GC. It's totally useless on any decent JVM implementation and if someone uses indecent JVM, I doubt he's concerned with his app efficiency.

> DirectoryIndexReader finalize() holding TermInfosReader longer than necessary
> -----------------------------------------------------------------------------
>
>                 Key: LUCENE-1715
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1715
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Index
>    Affects Versions: 2.4.1
>         Environment: Sun JDK 6 update 12 64-bit, Debian Lenny
>            Reporter: Brian Groose
>            Assignee: Michael McCandless
>             Fix For: 2.9
>
>
> DirectoryIndexReader has a finalize method, which causes the JDK to keep a reference to the object until it can be finalized.  SegmentReader and MultiSegmentReader are subclasses that contain references to, potentially, hundreds of megabytes of cached data in a TermInfosReader.
> Some options would be removing finalize() from DirectoryIndexReader (it releases a write lock at the moment) or possibly nulling out references in various close() and doClose() methods throughout the class hierarchy so that the finalizable object doesn't references the Term arrays.
> Original mailing list message:
> http://mail-archives.apache.org/mod_mbox/lucene-java-user/200906.mbox/%3C7A5CB4A7BBCE0C40B81C5145C326C31301A62971@NUMEVP06.na.imtn.com%3E

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-1715) DirectoryIndexReader finalize() holding TermInfosReader longer than necessary

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1715?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12723276#action_12723276 ] 

Michael McCandless commented on LUCENE-1715:
--------------------------------------------

I agree nulling is not a good practice to make GC faster.

But... for freeing up memory even if the app still holds a reference to the reader after closing it, I think this is in fact worthwhile.

> DirectoryIndexReader finalize() holding TermInfosReader longer than necessary
> -----------------------------------------------------------------------------
>
>                 Key: LUCENE-1715
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1715
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Index
>    Affects Versions: 2.4.1
>         Environment: Sun JDK 6 update 12 64-bit, Debian Lenny
>            Reporter: Brian Groose
>            Assignee: Michael McCandless
>             Fix For: 2.9
>
>
> DirectoryIndexReader has a finalize method, which causes the JDK to keep a reference to the object until it can be finalized.  SegmentReader and MultiSegmentReader are subclasses that contain references to, potentially, hundreds of megabytes of cached data in a TermInfosReader.
> Some options would be removing finalize() from DirectoryIndexReader (it releases a write lock at the moment) or possibly nulling out references in various close() and doClose() methods throughout the class hierarchy so that the finalizable object doesn't references the Term arrays.
> Original mailing list message:
> http://mail-archives.apache.org/mod_mbox/lucene-java-user/200906.mbox/%3C7A5CB4A7BBCE0C40B81C5145C326C31301A62971@NUMEVP06.na.imtn.com%3E

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-1715) DirectoryIndexReader finalize() holding TermInfosReader longer than necessary

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1715?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12723217#action_12723217 ] 

Michael McCandless commented on LUCENE-1715:
--------------------------------------------

SimpleFSDirectory.FSIndexInput's finalize() protects you from running out of descriptors, if you fail to close your reader; NativeFSLockFactory protects you if you forget to release the lock (close your writer). 

I agree, I think we should remove both of these.

> DirectoryIndexReader finalize() holding TermInfosReader longer than necessary
> -----------------------------------------------------------------------------
>
>                 Key: LUCENE-1715
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1715
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Index
>    Affects Versions: 2.4.1
>         Environment: Sun JDK 6 update 12 64-bit, Debian Lenny
>            Reporter: Brian Groose
>            Assignee: Michael McCandless
>             Fix For: 2.9
>
>
> DirectoryIndexReader has a finalize method, which causes the JDK to keep a reference to the object until it can be finalized.  SegmentReader and MultiSegmentReader are subclasses that contain references to, potentially, hundreds of megabytes of cached data in a TermInfosReader.
> Some options would be removing finalize() from DirectoryIndexReader (it releases a write lock at the moment) or possibly nulling out references in various close() and doClose() methods throughout the class hierarchy so that the finalizable object doesn't references the Term arrays.
> Original mailing list message:
> http://mail-archives.apache.org/mod_mbox/lucene-java-user/200906.mbox/%3C7A5CB4A7BBCE0C40B81C5145C326C31301A62971@NUMEVP06.na.imtn.com%3E

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Resolved: (LUCENE-1715) DirectoryIndexReader finalize() holding TermInfosReader longer than necessary

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-1715?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael McCandless resolved LUCENE-1715.
----------------------------------------

    Resolution: Fixed

Thanks Brian!

> DirectoryIndexReader finalize() holding TermInfosReader longer than necessary
> -----------------------------------------------------------------------------
>
>                 Key: LUCENE-1715
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1715
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Index
>    Affects Versions: 2.4.1
>         Environment: Sun JDK 6 update 12 64-bit, Debian Lenny
>            Reporter: Brian Groose
>            Assignee: Michael McCandless
>             Fix For: 2.9
>
>
> DirectoryIndexReader has a finalize method, which causes the JDK to keep a reference to the object until it can be finalized.  SegmentReader and MultiSegmentReader are subclasses that contain references to, potentially, hundreds of megabytes of cached data in a TermInfosReader.
> Some options would be removing finalize() from DirectoryIndexReader (it releases a write lock at the moment) or possibly nulling out references in various close() and doClose() methods throughout the class hierarchy so that the finalizable object doesn't references the Term arrays.
> Original mailing list message:
> http://mail-archives.apache.org/mod_mbox/lucene-java-user/200906.mbox/%3C7A5CB4A7BBCE0C40B81C5145C326C31301A62971@NUMEVP06.na.imtn.com%3E

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-1715) DirectoryIndexReader finalize() holding TermInfosReader longer than necessary

Posted by "Earwin Burrfoot (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1715?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12723225#action_12723225 ] 

Earwin Burrfoot commented on LUCENE-1715:
-----------------------------------------

And support removing finalizers everywhere if their only point is to guard against forgotten close().

> DirectoryIndexReader finalize() holding TermInfosReader longer than necessary
> -----------------------------------------------------------------------------
>
>                 Key: LUCENE-1715
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1715
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Index
>    Affects Versions: 2.4.1
>         Environment: Sun JDK 6 update 12 64-bit, Debian Lenny
>            Reporter: Brian Groose
>            Assignee: Michael McCandless
>             Fix For: 2.9
>
>
> DirectoryIndexReader has a finalize method, which causes the JDK to keep a reference to the object until it can be finalized.  SegmentReader and MultiSegmentReader are subclasses that contain references to, potentially, hundreds of megabytes of cached data in a TermInfosReader.
> Some options would be removing finalize() from DirectoryIndexReader (it releases a write lock at the moment) or possibly nulling out references in various close() and doClose() methods throughout the class hierarchy so that the finalizable object doesn't references the Term arrays.
> Original mailing list message:
> http://mail-archives.apache.org/mod_mbox/lucene-java-user/200906.mbox/%3C7A5CB4A7BBCE0C40B81C5145C326C31301A62971@NUMEVP06.na.imtn.com%3E

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Updated: (LUCENE-1715) DirectoryIndexReader finalize() holding TermInfosReader longer than necessary

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-1715?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael McCandless updated LUCENE-1715:
---------------------------------------

    Attachment: LUCENE-1715.patch

OK, attached patch nulling just a few things... I plan to commit in a day or two.


> DirectoryIndexReader finalize() holding TermInfosReader longer than necessary
> -----------------------------------------------------------------------------
>
>                 Key: LUCENE-1715
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1715
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Index
>    Affects Versions: 2.4.1
>         Environment: Sun JDK 6 update 12 64-bit, Debian Lenny
>            Reporter: Brian Groose
>            Assignee: Michael McCandless
>             Fix For: 2.9
>
>         Attachments: LUCENE-1715.patch
>
>
> DirectoryIndexReader has a finalize method, which causes the JDK to keep a reference to the object until it can be finalized.  SegmentReader and MultiSegmentReader are subclasses that contain references to, potentially, hundreds of megabytes of cached data in a TermInfosReader.
> Some options would be removing finalize() from DirectoryIndexReader (it releases a write lock at the moment) or possibly nulling out references in various close() and doClose() methods throughout the class hierarchy so that the finalizable object doesn't references the Term arrays.
> Original mailing list message:
> http://mail-archives.apache.org/mod_mbox/lucene-java-user/200906.mbox/%3C7A5CB4A7BBCE0C40B81C5145C326C31301A62971@NUMEVP06.na.imtn.com%3E

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Reopened: (LUCENE-1715) DirectoryIndexReader finalize() holding TermInfosReader longer than necessary

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-1715?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael McCandless reopened LUCENE-1715:
----------------------------------------


Reopening for nulling at least termInfosReader; we should probably null other memory intensive things like deleted docs & norms.

> DirectoryIndexReader finalize() holding TermInfosReader longer than necessary
> -----------------------------------------------------------------------------
>
>                 Key: LUCENE-1715
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1715
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Index
>    Affects Versions: 2.4.1
>         Environment: Sun JDK 6 update 12 64-bit, Debian Lenny
>            Reporter: Brian Groose
>            Assignee: Michael McCandless
>             Fix For: 2.9
>
>
> DirectoryIndexReader has a finalize method, which causes the JDK to keep a reference to the object until it can be finalized.  SegmentReader and MultiSegmentReader are subclasses that contain references to, potentially, hundreds of megabytes of cached data in a TermInfosReader.
> Some options would be removing finalize() from DirectoryIndexReader (it releases a write lock at the moment) or possibly nulling out references in various close() and doClose() methods throughout the class hierarchy so that the finalizable object doesn't references the Term arrays.
> Original mailing list message:
> http://mail-archives.apache.org/mod_mbox/lucene-java-user/200906.mbox/%3C7A5CB4A7BBCE0C40B81C5145C326C31301A62971@NUMEVP06.na.imtn.com%3E

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Issue Comment Edited: (LUCENE-1715) DirectoryIndexReader finalize() holding TermInfosReader longer than necessary

Posted by "Robert Newson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1715?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12723203#action_12723203 ] 

Robert Newson edited comment on LUCENE-1715 at 6/23/09 10:46 AM:
-----------------------------------------------------------------

I wonder if it's also worth examining the (very few) other places that have finalize()?

The mere presence of a finalize() method triggers different handling by the garbage collector.  Since all remaining finalize() methods appear to close resources that should have been closed explicitly, the same principle applies for those as for the resolution of LUCENE-1715?



      was (Author: rnewson):
    I wonder if it's also worth examining the (very few) other places that have finalize()?

The mere presence of a finalize() method triggers different handling by the garbage collector.  Since all remaining finalize() methods appear to close resources that should have been closed explicitly, the same principle applies for those as for the resolution of LUCENE-1715?

src/java/org/apache/lucene/store/SimpleFSDirectory.java:      protected void finalize() throws Throwable {
src/java/org/apache/lucene/store/SimpleFSDirectory.java-        try {
src/java/org/apache/lucene/store/SimpleFSDirectory.java-          close();
src/java/org/apache/lucene/store/SimpleFSDirectory.java-        } finally {
src/java/org/apache/lucene/store/SimpleFSDirectory.java:          super.finalize();
src/java/org/apache/lucene/store/SimpleFSDirectory.java-        }
src/java/org/apache/lucene/store/SimpleFSDirectory.java-      }
src/java/org/apache/lucene/store/SimpleFSDirectory.java-    }

src/java/org/apache/lucene/store/NativeFSLockFactory.java:  public void finalize() throws Throwable {
src/java/org/apache/lucene/store/NativeFSLockFactory.java-    try {
src/java/org/apache/lucene/store/NativeFSLockFactory.java-      if (isLocked()) {
src/java/org/apache/lucene/store/NativeFSLockFactory.java-        release();
src/java/org/apache/lucene/store/NativeFSLockFactory.java-      }
src/java/org/apache/lucene/store/NativeFSLockFactory.java-    } finally {
src/java/org/apache/lucene/store/NativeFSLockFactory.java:      super.finalize();
src/java/org/apache/lucene/store/NativeFSLockFactory.java-    }
src/java/org/apache/lucene/store/NativeFSLockFactory.java-  }
src/java/org/apache/lucene/store/NativeFSLockFactory.java-}


src/java/org/apache/lucene/index/IndexWriter.java-  /** Release the write lock, if needed. */
src/java/org/apache/lucene/index/IndexWriter.java:  protected void finalize() throws Throwable {
src/java/org/apache/lucene/index/IndexWriter.java-    try {
src/java/org/apache/lucene/index/IndexWriter.java-      if (writeLock != null) {
src/java/org/apache/lucene/index/IndexWriter.java-        writeLock.release();                        // release write lock
src/java/org/apache/lucene/index/IndexWriter.java-        writeLock = null;
src/java/org/apache/lucene/index/IndexWriter.java-      }
src/java/org/apache/lucene/index/IndexWriter.java-    } finally {
src/java/org/apache/lucene/index/IndexWriter.java:      super.finalize();
src/java/org/apache/lucene/index/IndexWriter.java-    }
src/java/org/apache/lucene/index/IndexWriter.java-  }

src/java/org/apache/lucene/index/DirectoryReader.java-  /** Release the write lock, if needed. */
src/java/org/apache/lucene/index/DirectoryReader.java:  protected void finalize() throws Throwable {
src/java/org/apache/lucene/index/DirectoryReader.java-    try {
src/java/org/apache/lucene/index/DirectoryReader.java-      if (writeLock != null) {
src/java/org/apache/lucene/index/DirectoryReader.java-        writeLock.release();                        // release write lock
src/java/org/apache/lucene/index/DirectoryReader.java-        writeLock = null;
src/java/org/apache/lucene/index/DirectoryReader.java-      }
src/java/org/apache/lucene/index/DirectoryReader.java-    } finally {
src/java/org/apache/lucene/index/DirectoryReader.java:      super.finalize();
src/java/org/apache/lucene/index/DirectoryReader.java-    }
src/java/org/apache/lucene/index/DirectoryReader.java-  }

  
> DirectoryIndexReader finalize() holding TermInfosReader longer than necessary
> -----------------------------------------------------------------------------
>
>                 Key: LUCENE-1715
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1715
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Index
>    Affects Versions: 2.4.1
>         Environment: Sun JDK 6 update 12 64-bit, Debian Lenny
>            Reporter: Brian Groose
>            Assignee: Michael McCandless
>             Fix For: 2.9
>
>
> DirectoryIndexReader has a finalize method, which causes the JDK to keep a reference to the object until it can be finalized.  SegmentReader and MultiSegmentReader are subclasses that contain references to, potentially, hundreds of megabytes of cached data in a TermInfosReader.
> Some options would be removing finalize() from DirectoryIndexReader (it releases a write lock at the moment) or possibly nulling out references in various close() and doClose() methods throughout the class hierarchy so that the finalizable object doesn't references the Term arrays.
> Original mailing list message:
> http://mail-archives.apache.org/mod_mbox/lucene-java-user/200906.mbox/%3C7A5CB4A7BBCE0C40B81C5145C326C31301A62971@NUMEVP06.na.imtn.com%3E

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-1715) DirectoryIndexReader finalize() holding TermInfosReader longer than necessary

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1715?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12723156#action_12723156 ] 

Michael McCandless commented on LUCENE-1715:
--------------------------------------------

I'd be inclined to remove the finalizer at this point.  Apps should not be relying on GC to release the write lock, and if they are, at best they get very buggy behavior (eg we don't flush changes to disk, other writers will sometimes to acquire the write lock because GC didn't finalize, etc.),

If we remove the finalizer then the closed SegmentReader should be GC'd promptly.

> DirectoryIndexReader finalize() holding TermInfosReader longer than necessary
> -----------------------------------------------------------------------------
>
>                 Key: LUCENE-1715
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1715
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Index
>    Affects Versions: 2.4.1
>         Environment: Sun JDK 6 update 12 64-bit, Debian Lenny
>            Reporter: Brian Groose
>            Assignee: Michael McCandless
>             Fix For: 2.9
>
>
> DirectoryIndexReader has a finalize method, which causes the JDK to keep a reference to the object until it can be finalized.  SegmentReader and MultiSegmentReader are subclasses that contain references to, potentially, hundreds of megabytes of cached data in a TermInfosReader.
> Some options would be removing finalize() from DirectoryIndexReader (it releases a write lock at the moment) or possibly nulling out references in various close() and doClose() methods throughout the class hierarchy so that the finalizable object doesn't references the Term arrays.
> Original mailing list message:
> http://mail-archives.apache.org/mod_mbox/lucene-java-user/200906.mbox/%3C7A5CB4A7BBCE0C40B81C5145C326C31301A62971@NUMEVP06.na.imtn.com%3E

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-1715) DirectoryIndexReader finalize() holding TermInfosReader longer than necessary

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1715?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12723180#action_12723180 ] 

Michael McCandless commented on LUCENE-1715:
--------------------------------------------

Does that really help GC?  (I thought not)

Had we left finalize in place, I agree nulling would help, because stuff can sit in the finalize queue for a while and nulling would have severed it.  But now since all of DirectoryReader will be GCd "at once", I didn't think nulling would help?

Though, I suppose what it would help is when someone closes the reader but then still hangs onto it, so perhaps we should do it?

> DirectoryIndexReader finalize() holding TermInfosReader longer than necessary
> -----------------------------------------------------------------------------
>
>                 Key: LUCENE-1715
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1715
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Index
>    Affects Versions: 2.4.1
>         Environment: Sun JDK 6 update 12 64-bit, Debian Lenny
>            Reporter: Brian Groose
>            Assignee: Michael McCandless
>             Fix For: 2.9
>
>
> DirectoryIndexReader has a finalize method, which causes the JDK to keep a reference to the object until it can be finalized.  SegmentReader and MultiSegmentReader are subclasses that contain references to, potentially, hundreds of megabytes of cached data in a TermInfosReader.
> Some options would be removing finalize() from DirectoryIndexReader (it releases a write lock at the moment) or possibly nulling out references in various close() and doClose() methods throughout the class hierarchy so that the finalizable object doesn't references the Term arrays.
> Original mailing list message:
> http://mail-archives.apache.org/mod_mbox/lucene-java-user/200906.mbox/%3C7A5CB4A7BBCE0C40B81C5145C326C31301A62971@NUMEVP06.na.imtn.com%3E

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-1715) DirectoryIndexReader finalize() holding TermInfosReader longer than necessary

Posted by "Simon Willnauer (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1715?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12723184#action_12723184 ] 

Simon Willnauer commented on LUCENE-1715:
-----------------------------------------

bq. Does that really help GC? (I thought not) 
It really depends on the VM implementation. In a dalvik VM people start nulling stuff all the time because it helps GC. In that case where a lot of memory can be collected I guess its worth to null the references. I generally do not null references but in this case I would really to it.

so +1 from my side.

> DirectoryIndexReader finalize() holding TermInfosReader longer than necessary
> -----------------------------------------------------------------------------
>
>                 Key: LUCENE-1715
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1715
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Index
>    Affects Versions: 2.4.1
>         Environment: Sun JDK 6 update 12 64-bit, Debian Lenny
>            Reporter: Brian Groose
>            Assignee: Michael McCandless
>             Fix For: 2.9
>
>
> DirectoryIndexReader has a finalize method, which causes the JDK to keep a reference to the object until it can be finalized.  SegmentReader and MultiSegmentReader are subclasses that contain references to, potentially, hundreds of megabytes of cached data in a TermInfosReader.
> Some options would be removing finalize() from DirectoryIndexReader (it releases a write lock at the moment) or possibly nulling out references in various close() and doClose() methods throughout the class hierarchy so that the finalizable object doesn't references the Term arrays.
> Original mailing list message:
> http://mail-archives.apache.org/mod_mbox/lucene-java-user/200906.mbox/%3C7A5CB4A7BBCE0C40B81C5145C326C31301A62971@NUMEVP06.na.imtn.com%3E

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Updated: (LUCENE-1715) DirectoryIndexReader finalize() holding TermInfosReader longer than necessary

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-1715?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael McCandless updated LUCENE-1715:
---------------------------------------

    Fix Version/s: 2.9

> DirectoryIndexReader finalize() holding TermInfosReader longer than necessary
> -----------------------------------------------------------------------------
>
>                 Key: LUCENE-1715
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1715
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Index
>    Affects Versions: 2.4.1
>         Environment: Sun JDK 6 update 12 64-bit, Debian Lenny
>            Reporter: Brian Groose
>            Assignee: Michael McCandless
>             Fix For: 2.9
>
>
> DirectoryIndexReader has a finalize method, which causes the JDK to keep a reference to the object until it can be finalized.  SegmentReader and MultiSegmentReader are subclasses that contain references to, potentially, hundreds of megabytes of cached data in a TermInfosReader.
> Some options would be removing finalize() from DirectoryIndexReader (it releases a write lock at the moment) or possibly nulling out references in various close() and doClose() methods throughout the class hierarchy so that the finalizable object doesn't references the Term arrays.
> Original mailing list message:
> http://mail-archives.apache.org/mod_mbox/lucene-java-user/200906.mbox/%3C7A5CB4A7BBCE0C40B81C5145C326C31301A62971@NUMEVP06.na.imtn.com%3E

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-1715) DirectoryIndexReader finalize() holding TermInfosReader longer than necessary

Posted by "Earwin Burrfoot (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1715?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12723289#action_12723289 ] 

Earwin Burrfoot commented on LUCENE-1715:
-----------------------------------------

There's in fact one case where nulling harms. I'm going to try making as much of IR as possible immutable and final. Load everything upfront on creation/reopen (or don't load if IR is created for, say, merging). Unlike nulling references, making frequently accessed fields final does have an impact under adequate JVMs.

Well, nulling can be added now and removed when/if I finish my IR stuff.

> DirectoryIndexReader finalize() holding TermInfosReader longer than necessary
> -----------------------------------------------------------------------------
>
>                 Key: LUCENE-1715
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1715
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Index
>    Affects Versions: 2.4.1
>         Environment: Sun JDK 6 update 12 64-bit, Debian Lenny
>            Reporter: Brian Groose
>            Assignee: Michael McCandless
>             Fix For: 2.9
>
>
> DirectoryIndexReader has a finalize method, which causes the JDK to keep a reference to the object until it can be finalized.  SegmentReader and MultiSegmentReader are subclasses that contain references to, potentially, hundreds of megabytes of cached data in a TermInfosReader.
> Some options would be removing finalize() from DirectoryIndexReader (it releases a write lock at the moment) or possibly nulling out references in various close() and doClose() methods throughout the class hierarchy so that the finalizable object doesn't references the Term arrays.
> Original mailing list message:
> http://mail-archives.apache.org/mod_mbox/lucene-java-user/200906.mbox/%3C7A5CB4A7BBCE0C40B81C5145C326C31301A62971@NUMEVP06.na.imtn.com%3E

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-1715) DirectoryIndexReader finalize() holding TermInfosReader longer than necessary

Posted by "Robert Newson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1715?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12723203#action_12723203 ] 

Robert Newson commented on LUCENE-1715:
---------------------------------------

I wonder if it's also worth examining the (very few) other places that have finalize()?

The mere presence of a finalize() method triggers different handling by the garbage collector.  Since all remaining finalize() methods appear to close resources that should have been closed explicitly, the same principle applies for those as for the resolution of LUCENE-1715?

src/java/org/apache/lucene/store/SimpleFSDirectory.java:      protected void finalize() throws Throwable {
src/java/org/apache/lucene/store/SimpleFSDirectory.java-        try {
src/java/org/apache/lucene/store/SimpleFSDirectory.java-          close();
src/java/org/apache/lucene/store/SimpleFSDirectory.java-        } finally {
src/java/org/apache/lucene/store/SimpleFSDirectory.java:          super.finalize();
src/java/org/apache/lucene/store/SimpleFSDirectory.java-        }
src/java/org/apache/lucene/store/SimpleFSDirectory.java-      }
src/java/org/apache/lucene/store/SimpleFSDirectory.java-    }

src/java/org/apache/lucene/store/NativeFSLockFactory.java:  public void finalize() throws Throwable {
src/java/org/apache/lucene/store/NativeFSLockFactory.java-    try {
src/java/org/apache/lucene/store/NativeFSLockFactory.java-      if (isLocked()) {
src/java/org/apache/lucene/store/NativeFSLockFactory.java-        release();
src/java/org/apache/lucene/store/NativeFSLockFactory.java-      }
src/java/org/apache/lucene/store/NativeFSLockFactory.java-    } finally {
src/java/org/apache/lucene/store/NativeFSLockFactory.java:      super.finalize();
src/java/org/apache/lucene/store/NativeFSLockFactory.java-    }
src/java/org/apache/lucene/store/NativeFSLockFactory.java-  }
src/java/org/apache/lucene/store/NativeFSLockFactory.java-}


src/java/org/apache/lucene/index/IndexWriter.java-  /** Release the write lock, if needed. */
src/java/org/apache/lucene/index/IndexWriter.java:  protected void finalize() throws Throwable {
src/java/org/apache/lucene/index/IndexWriter.java-    try {
src/java/org/apache/lucene/index/IndexWriter.java-      if (writeLock != null) {
src/java/org/apache/lucene/index/IndexWriter.java-        writeLock.release();                        // release write lock
src/java/org/apache/lucene/index/IndexWriter.java-        writeLock = null;
src/java/org/apache/lucene/index/IndexWriter.java-      }
src/java/org/apache/lucene/index/IndexWriter.java-    } finally {
src/java/org/apache/lucene/index/IndexWriter.java:      super.finalize();
src/java/org/apache/lucene/index/IndexWriter.java-    }
src/java/org/apache/lucene/index/IndexWriter.java-  }

src/java/org/apache/lucene/index/DirectoryReader.java-  /** Release the write lock, if needed. */
src/java/org/apache/lucene/index/DirectoryReader.java:  protected void finalize() throws Throwable {
src/java/org/apache/lucene/index/DirectoryReader.java-    try {
src/java/org/apache/lucene/index/DirectoryReader.java-      if (writeLock != null) {
src/java/org/apache/lucene/index/DirectoryReader.java-        writeLock.release();                        // release write lock
src/java/org/apache/lucene/index/DirectoryReader.java-        writeLock = null;
src/java/org/apache/lucene/index/DirectoryReader.java-      }
src/java/org/apache/lucene/index/DirectoryReader.java-    } finally {
src/java/org/apache/lucene/index/DirectoryReader.java:      super.finalize();
src/java/org/apache/lucene/index/DirectoryReader.java-    }
src/java/org/apache/lucene/index/DirectoryReader.java-  }


> DirectoryIndexReader finalize() holding TermInfosReader longer than necessary
> -----------------------------------------------------------------------------
>
>                 Key: LUCENE-1715
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1715
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Index
>    Affects Versions: 2.4.1
>         Environment: Sun JDK 6 update 12 64-bit, Debian Lenny
>            Reporter: Brian Groose
>            Assignee: Michael McCandless
>             Fix For: 2.9
>
>
> DirectoryIndexReader has a finalize method, which causes the JDK to keep a reference to the object until it can be finalized.  SegmentReader and MultiSegmentReader are subclasses that contain references to, potentially, hundreds of megabytes of cached data in a TermInfosReader.
> Some options would be removing finalize() from DirectoryIndexReader (it releases a write lock at the moment) or possibly nulling out references in various close() and doClose() methods throughout the class hierarchy so that the finalizable object doesn't references the Term arrays.
> Original mailing list message:
> http://mail-archives.apache.org/mod_mbox/lucene-java-user/200906.mbox/%3C7A5CB4A7BBCE0C40B81C5145C326C31301A62971@NUMEVP06.na.imtn.com%3E

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-1715) DirectoryIndexReader finalize() holding TermInfosReader longer than necessary

Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1715?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12723183#action_12723183 ] 

Uwe Schindler commented on LUCENE-1715:
---------------------------------------

That was my intention. :)

> DirectoryIndexReader finalize() holding TermInfosReader longer than necessary
> -----------------------------------------------------------------------------
>
>                 Key: LUCENE-1715
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1715
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Index
>    Affects Versions: 2.4.1
>         Environment: Sun JDK 6 update 12 64-bit, Debian Lenny
>            Reporter: Brian Groose
>            Assignee: Michael McCandless
>             Fix For: 2.9
>
>
> DirectoryIndexReader has a finalize method, which causes the JDK to keep a reference to the object until it can be finalized.  SegmentReader and MultiSegmentReader are subclasses that contain references to, potentially, hundreds of megabytes of cached data in a TermInfosReader.
> Some options would be removing finalize() from DirectoryIndexReader (it releases a write lock at the moment) or possibly nulling out references in various close() and doClose() methods throughout the class hierarchy so that the finalizable object doesn't references the Term arrays.
> Original mailing list message:
> http://mail-archives.apache.org/mod_mbox/lucene-java-user/200906.mbox/%3C7A5CB4A7BBCE0C40B81C5145C326C31301A62971@NUMEVP06.na.imtn.com%3E

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-1715) DirectoryIndexReader finalize() holding TermInfosReader longer than necessary

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1715?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12723164#action_12723164 ] 

Michael McCandless commented on LUCENE-1715:
--------------------------------------------

bq. I suggest removing finalize() from IndexWriter too.

+1

At best you get buggy behavior if somehow you're relying on these finalizers...

I plan to commit shortly.

> DirectoryIndexReader finalize() holding TermInfosReader longer than necessary
> -----------------------------------------------------------------------------
>
>                 Key: LUCENE-1715
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1715
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Index
>    Affects Versions: 2.4.1
>         Environment: Sun JDK 6 update 12 64-bit, Debian Lenny
>            Reporter: Brian Groose
>            Assignee: Michael McCandless
>             Fix For: 2.9
>
>
> DirectoryIndexReader has a finalize method, which causes the JDK to keep a reference to the object until it can be finalized.  SegmentReader and MultiSegmentReader are subclasses that contain references to, potentially, hundreds of megabytes of cached data in a TermInfosReader.
> Some options would be removing finalize() from DirectoryIndexReader (it releases a write lock at the moment) or possibly nulling out references in various close() and doClose() methods throughout the class hierarchy so that the finalizable object doesn't references the Term arrays.
> Original mailing list message:
> http://mail-archives.apache.org/mod_mbox/lucene-java-user/200906.mbox/%3C7A5CB4A7BBCE0C40B81C5145C326C31301A62971@NUMEVP06.na.imtn.com%3E

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Assigned: (LUCENE-1715) DirectoryIndexReader finalize() holding TermInfosReader longer than necessary

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-1715?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael McCandless reassigned LUCENE-1715:
------------------------------------------

    Assignee: Michael McCandless

> DirectoryIndexReader finalize() holding TermInfosReader longer than necessary
> -----------------------------------------------------------------------------
>
>                 Key: LUCENE-1715
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1715
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Index
>    Affects Versions: 2.4.1
>         Environment: Sun JDK 6 update 12 64-bit, Debian Lenny
>            Reporter: Brian Groose
>            Assignee: Michael McCandless
>             Fix For: 2.9
>
>
> DirectoryIndexReader has a finalize method, which causes the JDK to keep a reference to the object until it can be finalized.  SegmentReader and MultiSegmentReader are subclasses that contain references to, potentially, hundreds of megabytes of cached data in a TermInfosReader.
> Some options would be removing finalize() from DirectoryIndexReader (it releases a write lock at the moment) or possibly nulling out references in various close() and doClose() methods throughout the class hierarchy so that the finalizable object doesn't references the Term arrays.
> Original mailing list message:
> http://mail-archives.apache.org/mod_mbox/lucene-java-user/200906.mbox/%3C7A5CB4A7BBCE0C40B81C5145C326C31301A62971@NUMEVP06.na.imtn.com%3E

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-1715) DirectoryIndexReader finalize() holding TermInfosReader longer than necessary

Posted by "Earwin Burrfoot (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1715?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12723157#action_12723157 ] 

Earwin Burrfoot commented on LUCENE-1715:
-----------------------------------------

+1
I suggest removing finalize() from IndexWriter too.

If someone forgets to close IR/IW - that's his personal problem. (Which, in the abscence of finalizer he'll going to notice and fix pretty soon)

> DirectoryIndexReader finalize() holding TermInfosReader longer than necessary
> -----------------------------------------------------------------------------
>
>                 Key: LUCENE-1715
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1715
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Index
>    Affects Versions: 2.4.1
>         Environment: Sun JDK 6 update 12 64-bit, Debian Lenny
>            Reporter: Brian Groose
>            Assignee: Michael McCandless
>             Fix For: 2.9
>
>
> DirectoryIndexReader has a finalize method, which causes the JDK to keep a reference to the object until it can be finalized.  SegmentReader and MultiSegmentReader are subclasses that contain references to, potentially, hundreds of megabytes of cached data in a TermInfosReader.
> Some options would be removing finalize() from DirectoryIndexReader (it releases a write lock at the moment) or possibly nulling out references in various close() and doClose() methods throughout the class hierarchy so that the finalizable object doesn't references the Term arrays.
> Original mailing list message:
> http://mail-archives.apache.org/mod_mbox/lucene-java-user/200906.mbox/%3C7A5CB4A7BBCE0C40B81C5145C326C31301A62971@NUMEVP06.na.imtn.com%3E

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-1715) DirectoryIndexReader finalize() holding TermInfosReader longer than necessary

Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1715?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12723174#action_12723174 ] 

Uwe Schindler commented on LUCENE-1715:
---------------------------------------

I would still additionally null the references Brian notes for even faster release by GC?

> DirectoryIndexReader finalize() holding TermInfosReader longer than necessary
> -----------------------------------------------------------------------------
>
>                 Key: LUCENE-1715
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1715
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Index
>    Affects Versions: 2.4.1
>         Environment: Sun JDK 6 update 12 64-bit, Debian Lenny
>            Reporter: Brian Groose
>            Assignee: Michael McCandless
>             Fix For: 2.9
>
>
> DirectoryIndexReader has a finalize method, which causes the JDK to keep a reference to the object until it can be finalized.  SegmentReader and MultiSegmentReader are subclasses that contain references to, potentially, hundreds of megabytes of cached data in a TermInfosReader.
> Some options would be removing finalize() from DirectoryIndexReader (it releases a write lock at the moment) or possibly nulling out references in various close() and doClose() methods throughout the class hierarchy so that the finalizable object doesn't references the Term arrays.
> Original mailing list message:
> http://mail-archives.apache.org/mod_mbox/lucene-java-user/200906.mbox/%3C7A5CB4A7BBCE0C40B81C5145C326C31301A62971@NUMEVP06.na.imtn.com%3E

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Resolved: (LUCENE-1715) DirectoryIndexReader finalize() holding TermInfosReader longer than necessary

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-1715?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael McCandless resolved LUCENE-1715.
----------------------------------------

    Resolution: Fixed

Thanks Brian!

> DirectoryIndexReader finalize() holding TermInfosReader longer than necessary
> -----------------------------------------------------------------------------
>
>                 Key: LUCENE-1715
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1715
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Index
>    Affects Versions: 2.4.1
>         Environment: Sun JDK 6 update 12 64-bit, Debian Lenny
>            Reporter: Brian Groose
>            Assignee: Michael McCandless
>             Fix For: 2.9
>
>         Attachments: LUCENE-1715.patch
>
>
> DirectoryIndexReader has a finalize method, which causes the JDK to keep a reference to the object until it can be finalized.  SegmentReader and MultiSegmentReader are subclasses that contain references to, potentially, hundreds of megabytes of cached data in a TermInfosReader.
> Some options would be removing finalize() from DirectoryIndexReader (it releases a write lock at the moment) or possibly nulling out references in various close() and doClose() methods throughout the class hierarchy so that the finalizable object doesn't references the Term arrays.
> Original mailing list message:
> http://mail-archives.apache.org/mod_mbox/lucene-java-user/200906.mbox/%3C7A5CB4A7BBCE0C40B81C5145C326C31301A62971@NUMEVP06.na.imtn.com%3E

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-1715) DirectoryIndexReader finalize() holding TermInfosReader longer than necessary

Posted by "Simon Willnauer (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1715?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12723283#action_12723283 ] 

Simon Willnauer commented on LUCENE-1715:
-----------------------------------------

I is def. not good practice and I agree that a decent VM should not care. In some environments you don't have a choice (mobile phones for instance) and if selected pieces of "nulling" code can speed things up we should do it. I will run a benchmark on a dalivk VM (Android) to show the difference with the change. I might not have time today or tomorrow though. 
This change is not visible to anybody using lucene so to me its not that much of a deal. 
To be honest I'm not a fan of doing that at all but in this case it "could" be useful in some corner cases but does not harm anybody.

> DirectoryIndexReader finalize() holding TermInfosReader longer than necessary
> -----------------------------------------------------------------------------
>
>                 Key: LUCENE-1715
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1715
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Index
>    Affects Versions: 2.4.1
>         Environment: Sun JDK 6 update 12 64-bit, Debian Lenny
>            Reporter: Brian Groose
>            Assignee: Michael McCandless
>             Fix For: 2.9
>
>
> DirectoryIndexReader has a finalize method, which causes the JDK to keep a reference to the object until it can be finalized.  SegmentReader and MultiSegmentReader are subclasses that contain references to, potentially, hundreds of megabytes of cached data in a TermInfosReader.
> Some options would be removing finalize() from DirectoryIndexReader (it releases a write lock at the moment) or possibly nulling out references in various close() and doClose() methods throughout the class hierarchy so that the finalizable object doesn't references the Term arrays.
> Original mailing list message:
> http://mail-archives.apache.org/mod_mbox/lucene-java-user/200906.mbox/%3C7A5CB4A7BBCE0C40B81C5145C326C31301A62971@NUMEVP06.na.imtn.com%3E

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org