[jsword-devel] API Examples OutOfMemory Error

DM Smith dmsmith at crosswire.org
Tue Jan 4 08:13:46 MST 2011


On 01/03/2011 11:41 PM, Joe Kumar wrote:
> Hi all,
>
> I've been trying out APIExamples.java and initially had issues 
> with examples.search();
> There was no index for the "Book" and so I modified getIndex(Book 
> book) in LuceneIndexManager to create an index if there was no index
>
> if (reply == null) {
>
>                 URI storage = getStorageArea(book);
>
> if(isIndexed(book)){
>
>                     reply = new LuceneIndex(book, storage);
>
>                 }
>
> else{
>
>                     reply = new LuceneIndex(book, storage,true);
>
>                 }
>
> INDEXES.put(book, reply);
>
>             }
>
>
> After this change, examples.search worked fine.
>

I'll look into making that change. We need to make sure that index 
creation is still under the control of the end user.

> Now examples.rankedSearch(); is failing with an OutOfMemory Error. 
> Stacktrace is like below
>
>
> org.crosswire.jsword.index.lucene.LuceneIndex(INFO): 
> ParsedQuery-content:for content:god content:so content:loved 
> content:the content:world
>
>  Exception in thread "main" java.lang.OutOfMemoryError: Requested 
> array size exceeds VM limit
>
> at org.apache.lucene.util.PriorityQueue.initialize(PriorityQueue.java:105)
>
> at org.apache.lucene.search.HitQueue.<init>(HitQueue.java:67)
>
> at 
> org.apache.lucene.search.TopScoreDocCollector.<init>(TopScoreDocCollector.java:126)
>
> at 
> org.apache.lucene.search.TopScoreDocCollector.<init>(TopScoreDocCollector.java:37)
>
> at 
> org.apache.lucene.search.TopScoreDocCollector$OutOfOrderTopScoreDocCollector.<init>(TopScoreDocCollector.java:74)
>
> at 
> org.apache.lucene.search.TopScoreDocCollector$OutOfOrderTopScoreDocCollector.<init>(TopScoreDocCollector.java:72)
>
> at 
> org.apache.lucene.search.TopScoreDocCollector.create(TopScoreDocCollector.java:115)
>
> at 
> org.crosswire.jsword.index.lucene.LuceneIndex.find(LuceneIndex.java:263)
>
>
> I modified the VM args to -Xmx1024m -Xms1024m and still having this issue
>
> Has anyone else faced the same problem. is APIExamples working fine 
> for everyone ?
>
It is a problem for everyone. Seems Lucene has changed its internal 
implementation such that this way is now bad. I'll see about updating it 
soon.
Bible Desktop does not have the problem. So it is fixable.

> I am using Eclipse 3.5 on OSX Snow Leopard.
>
>
> Any directions would be greatly appreciated.
>
>
>
> thanks
>
> Joe.
>
>
>
>
>
>
>
> _______________________________________________
> jsword-devel mailing list
> jsword-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/jsword-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.crosswire.org/pipermail/jsword-devel/attachments/20110104/1eaf0fd0/attachment-0001.html>


More information about the jsword-devel mailing list