[ https://issues.apache.org/jira/browse/LUCENENET-106?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12556259#action_12556259
]
digydigy edited comment on LUCENENET-106 at 1/5/08 2:48 PM:
--------------------------------------------------------
Since "readerCache" in "FieldCacheImpl.Cache.Get()" stores references to IndexReaders, IndexReaders
are never garbage-collected.
Instead of using the IndexReader itself,using the HashCode of it as key allows it to get garbage-collected.
This change eliminates most of the memory leakage.
But still the entry of the garbage-collected IndexReader remains in readerCache. This is the
second reason of the memory leakage.
I will send another patch that utilizes WeakReference to determine whether an IndexReader
is garbage-collected or not. If Yes,then the entry in readerCache can safely be removed.
This patch(DIGY-FieldCacheImpl.patch) does not require a change in IndexReader class.
was (Author: digydigy):
Since "readerCache" in "FieldCacheImpl.Cache.Get()" stores a reference to IndexReaders,
IndexReaders are never garbage-collected.
Instead of using the IndexReader itself,using the HashCode of it as key allows it to get garbage-collected.
This change eliminates most of the memory leakage.
But still the entry of the garbage-collected IndexReader remains in readerCache. This is the
second reason of the memory leakage.
I will send another patch that utilizes WeakReference to determine whether an IndexReader
is garbage-collected or not. If Yes,then the entry in readerCache can safely be removed.
This patch(DIGY-FieldCacheImpl.patch) does not require a change in IndexReader class.
> Lucene.NET (Revision: 603121) is leaking memory
> -----------------------------------------------
>
> Key: LUCENENET-106
> URL: https://issues.apache.org/jira/browse/LUCENENET-106
> Project: Lucene.Net
> Issue Type: Bug
> Environment: .NET 2.0
> Reporter: Anton K.
> Priority: Critical
> Attachments: DIGY-FieldCacheImpl.patch, Digy.rar, luceneSrc_memUsage.patch
>
>
> readerCache Hashtable field (see FieldCacheImpl.cs) never releases some hash items that
have closed IndexReader object as a key. So a lot of Term instances are never released.
> Java version of Lucene uses WeakHashMap and therefore doesn't have this problem.
> This bug can be reproduced only when Sort functionality used during search.
> See following link for additional information.
> http://www.gossamer-threads.com/lists/lucene/java-user/55681
> Steps to reproduce:
> 1)Create index
> 2) Modify index by IndexWiter; Close IndexWriter
> 3) Use IndexSearcher for searching with Sort; Close InexSearcher
> 4) Go to step 2
> You'll get OutOfMemoryException after some time of running this algorithm.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
|