Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Too small initial heap error - stanford parser

Tags:

stanford-nlp

I am trying my hands on the Stanford dependency parser. I tried running the parser from command line on windows to extract the dependencies using this command:

java -mx100m -cp "stanford-parser.jar" edu.stanford.nlp.trees.EnglishGrammaticalStructure -sentFile english-onesent.txt -collapsedTree -CCprocessed -parserFile englishPCFG.ser.gz

I am getting the following error:

Error occurred during initialization of VM  
Too small initial heap

I changed the memory size to -mx1024, -mx2048 as well as -mx4096. It didn't change anything and the error persists.

What am I missing?

like image 981
Viper Avatar asked Sep 21 '15 01:09

Viper


People also ask

How to fix error occurred during initialization of vm too small initial heap?

You can resolve this issue by running Solaris JVM with option -d64. -d64 command-line option allows JVM to use a 64-bit data model if available.

How do you fix initial heap size set to a larger value than the maximum heap size?

[Fixed] Initial heap size set to a larger value than the maximum heap size. To get rid of this error, the value of Xmx(maximum heap size) should always be greater than or equal to Xms(minimum heap size).

How do I fix invalid max heap size?

If you look carefully you will space between -Xmx and 1800M, which is causing "Could not create the Java virtual machine: Invalid maximum heap size -Xmx". syntactically there should not be any space between -Xmx and heap size. Just remove the space between -Xmx and 1400M and it will work.


2 Answers

Type -Xmx1024m instead of -mx1024.

See https://docs.oracle.com/javase/8/docs/technotes/tools/windows/java.html

like image 181
sndyuk Avatar answered Jan 16 '23 12:01

sndyuk


It should be -mx1024m. I skipped m.

One more thing: in the -cp, the model jar should also be included.

... -cp "stanford-parser.jar;stanford-parser-3.5.2-models.jar"...

(assuming you are using the latest version).

Otherwise an IO Exception will be thrown.

like image 21
Viper Avatar answered Jan 16 '23 12:01

Viper