You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by wgggfiy <wu...@qq.com> on 2013/01/27 05:39:11 UTC

how to avoid OutOfMemoryError while indexing ?

I found it is very easy to come into OutOfMemoryError.
My idea is that lucene could set the RAM memory Automatically,
but I couldn't find the API. My code: 

IndexWriterConfig iwc = new IndexWriterConfig(Version.LUCENE_40, analyzer);
int mb = 1024 * 1024;
double ram = Runtime.getRuntime().maxMemory() / mb;
iwc.setRAMBufferSizeMB(ram);

but still OutOfMemoryError, can anyone help me ? thx



-----
--------------------------
Email: wuqiu.main@qq.com
--------------------------
--
View this message in context: http://lucene.472066.n3.nabble.com/how-to-avoid-OutOfMemoryError-while-indexing-tp4036484.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.

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


Re: how to avoid OutOfMemoryError while indexing ?

Posted by Michael McCandless <lu...@mikemccandless.com>.
You should set your RAMBufferSizeMB to something smaller than the full
heap size of your JVM.

Mike McCandless

http://blog.mikemccandless.com

On Sat, Jan 26, 2013 at 11:39 PM, wgggfiy <wu...@qq.com> wrote:
> I found it is very easy to come into OutOfMemoryError.
> My idea is that lucene could set the RAM memory Automatically,
> but I couldn't find the API. My code:
>
> IndexWriterConfig iwc = new IndexWriterConfig(Version.LUCENE_40, analyzer);
> int mb = 1024 * 1024;
> double ram = Runtime.getRuntime().maxMemory() / mb;
> iwc.setRAMBufferSizeMB(ram);
>
> but still OutOfMemoryError, can anyone help me ? thx
>
>
>
> -----
> --------------------------
> Email: wuqiu.main@qq.com
> --------------------------
> --
> View this message in context: http://lucene.472066.n3.nabble.com/how-to-avoid-OutOfMemoryError-while-indexing-tp4036484.html
> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>

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