lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Willnauer <simon.willna...@googlemail.com>
Subject Re: Outof memory exception on using Integer.MaxValue
Date Tue, 28 Dec 2010 09:13:05 GMT
MultiSearcher uses the given integer as the expected number of results
and creates a hitqueue for it. Since you are asking for INT_MAX hits
Lucene creates a hitQueue for either INT_MAX or maxDoc() documents and
preallocates that memory. So in the worst case it creates an Object
array with INTEGER_MAX elements - each taking 8 bytes as the object
reference on a 64 bit VM - unless you have lots of heap space this
will make your vm barf.

you should only specify the number of documents you really want no
blindly get all of them.

why your query returns 0 docs is a different question.

simon

On Tue, Dec 28, 2010 at 8:00 AM, Jawahar Lal <jlal@chambal.com> wrote:
> Hi,
>
>  I am using multiSearcher as
>
> objMultiSearcher.search(query,null,Integer.MaxValue);
>
> I searched a query, which should & does not return any hit. As I run the
> query, the above statement throw OutofMemory exception. I change the
> Integer.MaxValue TO 100, then I again searched, it returned 0 hit.
>
> Why its thowing memory exception, even there is not hit found for the query
> ?
>
> Thanks
>

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


Mime
View raw message