2

I'm trying to load Google news corpus using this code:

           File gModel = new File("/word2vec/GoogleNews-vectors-negative300.bin.gz");
Word2Vec vec = WordVectorSerializer.loadGoogleModel(gModel, true);

but it causes this error:

    Exception in thread "main" java.lang.OutOfMemoryError: Java heap space

I tried to change VM options parameters like it explained in official documenatation of deeplearning4j with:

         -Xms1024m -Xmx10g -XX:MaxPermSize=2g 
Nana
  • 21
  • 4
  • I'll assume you're using a 64 bit JDK 7 and that the machine has > 10G physical memory available. You might think about changing to JDK 8. Perm space is gone - it uses meta space. – duffymo Nov 22 '16 at 15:08
  • for %i in (javac.exe) do @echo. %~$PATH:i C:\Program Files\Java\jdk1.8.0_05\bin\javac.exe .. the JDK that i'm using.. should i change it ? – Nana Nov 22 '16 at 15:12
  • JDK 8 looks fine. Is it a 64 bit version running on a 64 bit Windows operating system? Do you have more than 10GB of physical memory installed and available? – duffymo Nov 22 '16 at 15:13
  • it's 64 bit windows.. no i dont have 10 .. there is no other solution ? – Nana Nov 22 '16 at 15:15
  • Seems silly to ask for more memory than is available. You have to leave enough for OS, etc. JDK 8 doesn't have perm space; it's meta space. You should investigate increasing the size of your meta space. Don't go for something that large at first. Do some reading. – duffymo Nov 22 '16 at 15:19

1 Answers1

0

I found this as I ran in a similar issue. I noticed this was never answered and I wonder if anyone cares. However, setting these VM arguments did it for me (I have 8G physical memory):

-Xms1024m -Xmx6g -XX:MaxPermSize=6g
aminography
  • 21,986
  • 13
  • 70
  • 74