1

I'm not a programmer, I only want to setup a document server with regain. It's normal, that the process of indexing needs a lot of memory so when I start indexing I type to the code -Xmx512m. But after some hours, I've got these messages:

java.lang.OutOfMemoryError: Java heap space
    at org.apache.lucene.util.UnicodeUtil.UTF16toUTF8(UnicodeUtil.java:383)
    at org.apache.lucene.store.DataOutput.writeString(DataOutput.java:112)
    at org.apache.lucene.index.FieldsWriter.writeField(FieldsWriter.java:212)
    at org.apache.lucene.index.StoredFieldsWriterPerThread.addField(StoredFieldsWriterPe
rThread.java:58)
    at org.apache.lucene.index.DocFieldProcessorPerThread.processDocument(DocFieldProces
sorPerThread.java:263)
    at org.apache.lucene.index.DocumentsWriter.updateDocument(DocumentsWriter.java:766)
    at org.apache.lucene.index.IndexWriter.addDocument(IndexWriter.java:2060)
    at org.apache.lucene.index.IndexWriter.addDocument(IndexWriter.java:2034)
    at net.sf.regain.crawler.IndexWriterManager.createNewIndexEntry(IndexWriterManager.j
ava:758)
    at net.sf.regain.crawler.IndexWriterManager.addToIndex(IndexWriterManager.java:732)
    at net.sf.regain.crawler.Crawler.run(Crawler.java:575)
    at net.sf.regain.crawler.Main.main(Main.java:128)

I'm using jdk 1.8 and tomcat7 Its running on a Windows Server 2016 with 4GB Memory, but i dont think that this process needs more than 1GB memory... Now I don't know how to solve this problem... Does anyone know how to solve this problem?

  • if you have no way of editing or even viewing the code, you might just try to increase the heap space, here's an already given answer to how you can do it: http://stackoverflow.com/a/1566026/3858121 – Japu_D_Cret Mar 23 '17 at 12:56
  • -Xmx1024m -XX:MaxPermSize=256m add this line in Vm Argumnets of eclipse configuration. – santosh gore Mar 23 '17 at 12:58
  • I'm voting to close this question as off-topic because it is not a programming question as defined in the [help] guidelines. – Ken White Mar 23 '17 at 13:07
  • what is the available memory on the machine where you are running this application? If there is enough memory then you can increase the max heap to -Xmx1024m or my be -Xmx1536m – ProgrammerBoy Mar 23 '17 at 13:15

3 Answers3

0

try -Xmx512m instead of -Xnx512m

0

Run with -Xmx, which sets the maximum size of the heap.

See here for details

Ex : -Xmx512m

shas
  • 703
  • 2
  • 8
  • 31
0

Please suggest which version of java you are using?? Below are some solution that you can apply .. ->Increase Heap and permGem space (temporary fix) ->Find memory leaks , fix it then right high performance code . ->catch java.lang.OutOfMemoryError and free all resources that you know might use a lot of memory, close connections and so forth, then do a System.gc(). ->use JDK 1.8 :þ welcome to the MetaSpace ->The solution was to add these flags to JVM command line when Tomcat is started: -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled

hope this will help you :-)