Alex Mueller on Software and Technology 
Sunday, October 29, 2006

Recently I came across a situation that appeared to be a memory leak with the 1.9.0.5 version of the Lucene.Net build. After three days on the new job I was finally able to get my hands dirty in new code and it felt great to be involved again. I was hoping to spend my time familiarizing myself with the functionality and design of a new web application with in ASP.NET with C#.

This web application is using Lucene.Net as its search engine, as a replacement for the FAST search implementation. A C# utility was written to create indices when new data becomes present, however, this application would steadily increase memory utilization up to 2GB. The rapid memory consumption was crippling our server. Rather than enjoying my first experiences in a new applications codebase, I had to figure out why this utility was eating memory.

After plenty of debugging and observations, I decided to improve memory management with our Lucene specific classes. All the objects were disposing properly. I made the objects disposable and destroyed or closed resources whenever possible. This did not make a difference in memory.

I finally came across a website where someone has seen similar issues. The site is translated from Chinese, but the message mentions that Lucene.Net will have memory leakage problems until the 1.9.1-001-13Jul06 version. If you must use a previous version, you can see a work-around solution on that site.

In code, as well as when using Microsoft's CLR Profiler, I was determining the source of the memory leak was in a compiled Lucene function, Lucene.Net.QueryParsers.QueryParser.Parse(query, searchField, analyzer). I would have to rebuild Lucene anyway if I were to fix it, so I decided to move to the latest version to save me the headache.

The version I am using now is 1.9.1.3 of Lucene.Net. This resolved my utility's memory consumption, and all is right in the world again. All too often I assume the code I am using from open-source or third party vendors is optimized and dependabl

Sunday, October 29, 2006 8:20:33 PM (Mountain Standard Time, UTC-07:00) | Comments [0] | Technology#
Comments are closed.
MuellerDesigns.net
Search
On This Page
PowerShell Documentation
Automate Daily Tasks with PowerShell
SketchPath XPath Editor
Software Testing - Revisited
Architecting Buildings and Software
NBCOlympics.com with Silverlight
Marker Interfaces and C# Attributes
The Phone Screen
Working with ASP.NET MVC and MvcContrib
Thanks to BDD
Twitter
The Opposite of a Singleton?
Removing Duplicate Code in Functions
Add Vista Themes to Longhorn
Changing File Ownership In Vista and Longhorn
Most Popular
JavaScript ReplaceAll Functionality
What is polymorphism?
What is composition?
Sorting with IComparable and IComparer
Applying the Observer Pattern in ASP.NET
MVP in ASP.NET
What is abstraction?
What is encapsulation?
What is a class?
What is inheritance?
Authentication in ASP.NET
Calendar Controls
XPathNavigator.CheckValidity new for 2.0
SQL Server 2005 Connection Issues
Auto-attach to process '[####] aspnet_wp.exe' on m...
What is an object?
FreeTextBox
VMWare and VPC
An Example of Reflection using C#
Caring for the Team
Archive
Links
Categories
My Local Blog Map
Blogroll
About
Powered by:

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2009
MuellerDesigns.net

Sign In

Help Those In Need
The Hunger Site
Ronald McDonald House Charities (RMHC) of Western Washington & Alaska