Too small initial heap error - stanford parser
Asked Answered
D

3

7

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?

Dahl answered 21/9, 2015 at 1:50 Comment(0)
S
11

Type -Xmx1024m instead of -mx1024.

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

Sorghum answered 21/9, 2015 at 2:55 Comment(1)
Thanks for the suggestion. -mx works fine now. Please see below why it didn't work earlier.Dahl
D
7

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.

Dahl answered 21/9, 2015 at 5:39 Comment(0)
J
0

There may be some arguments that are preexisting in the IDE. In eclipse: Go to-> Run as-> run configuration-> Arguments then Delete the arguments that are used previously. Restart your eclipse. Worked for me!

Jackal answered 4/2, 2019 at 8:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.