[
https://issues.apache.org/jira/browse/LUCENENET-106?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
eyal post updated LUCENENET-106:
--------------------------------
Attachment: WeakHashTable_ep.zip
Here's my version for review. I decided to go for the other extreme - that is
implementing a fully working WeakHashTable implementing all IDictionary
methods. I also decided to implement it a bit different than Tj's for
performance reasons.
All tests are passing with this including Tj's tests and some of my own tests.
How is this implementation different:
1. Fully implements IDictionary according to IDictionary rules (i.e. Add()
throws an exception if the same key is passed twice)
2. Internally uses a regular hashtable with a custom comparer. This means that
to search for a key there is no need to create a WeakKey instance - instead you
can search by using the original key and the comparer does the searching. This
increases performance since for regular access you don't need to create a
WeakKey object just to compare it to exisiting keys.
3. Cleanup is called only if a GC occoured. This greatly improves performance
since there's no need to iterate over the entire table trying to clean entries
if no GC occoured.
Some of the tests I included are performance tests. Running them on my machines
show the following:
TjWeakHashTable WeakHashTable
Get 2.5 0.7
Add 2.2 1.9
Contains 2.2 0.65
Remove 4.5 2.5
Replace 2.8 2.8
Please review and let me know if you have any comments
> 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.
> Assignee: Digy
> Priority: Critical
> Attachments: DIGY-FieldCacheImpl.patch, Digy.rar,
> luceneSrc_memUsage.patch, Paches for v2.3.1.rar, WeakHashTable v2.patch,
> WeakHashTable v2.patch, WeakHashTable+FieldCacheImpl.rar,
> WeakHashTable_ep.zip, WeakHashTable_tj.zip, WeakReferences.rar
>
>
> 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.