lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Digy" <>
Subject RE: [jira] Commented: (LUCENENET-106) Lucene.NET (Revision: 603121) is leaking memory
Date Fri, 09 Jan 2009 18:02:59 GMT
Hi Tim,


Thanks for the comments. I will correct the 3,4,5.


1) Since ArrayList contains WeakEntries & sync.ed for multiple threads, they can not be
null and can not be any other type. I can not find a bug here. Maybe you can send a more detailed

2), WeakHashTable is compatible with "HashTable" in .Net world. "Ht.Add(key,value)" throws
an exception for duplicate keys but

"Ht[key]=value" just adds or replaces.







-----Original Message-----
From: Tim Januario (JIRA) [] 
Sent: Friday, January 09, 2009 7:16 PM
Subject: [jira] Commented: (LUCENENET-106) Lucene.NET (Revision: 603121) is leaking memory





Tim Januario commented on LUCENENET-106:




1) The WeakHashTable.Exists method creates a possible NullReferenceException because you used
WeakEntries[i] As WeakEntry instead of (WeakEntry)WeakEntries[i].  This is only a warning

2) The Java WeakHashMap does not throw an execption when put() is called with a key that already
exists in the table.  It simply replaces the old value with the new value.  .NET Hashtable
does the same.  The Add method of WeakHashTable should remove the WeakEntry if the key is
found and replace it with the new value in order to stay in line instead of throwing the Exception.

3) WeakHashTableEnumarator should be WeakHashTableEnumerator

4) WeakEntry.HashCode is not used and should be removed.

5) WeakHashTable.InitialMem is not used and should be removed.


Other than that, I think this looks good.




> Lucene.NET (Revision: 603121) is leaking memory

> -----------------------------------------------


>                 Key: LUCENENET-106

>                 URL:

>             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+FieldCacheImpl.rar, 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.


> 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.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message