4

I am running neo4j 2.1.7 on a windows 8.1 pro laptop. I have 16G of RAM, but I keep running out of heap memory. I have a large-ish database of maybe 250K nodes, but nothing close to what I am planning to run.

I have set -Xmx to 1024m in neo4j-community.vmoptions. I tried to increase it to more, but neo4j-community.exe won't start up.

Any advice would be gratefully received

Regards, Richard

rick.it.2004
  • 231
  • 4
  • 11
  • what's the error you get when you start exe? – SMA Feb 26 '15 at 13:33
  • how are you setting max memory ? What is the error you see when you start `neo4j-community.exe` ? – Arkantos Feb 26 '15 at 13:42
  • The default maximum heap for a 64-bit JVM is 1/4 of main memory or 4GB, is there any reason you are decreasing it? – Peter Lawrey Feb 26 '15 at 13:50
  • there is no error message produced, it just doesn't start up. – rick.it.2004 Feb 26 '15 at 14:02
  • I want to set it to 4G, but it won't let me go past 1G. I have 10G of RAM sitting unused, very frustrating – rick.it.2004 Feb 26 '15 at 14:03
  • I'm simply setting -Xmx1024m in the vmoptions file – rick.it.2004 Feb 26 '15 at 14:04
  • so `-Xmx4g` is vmoptions is not working for you ? – Arkantos Feb 26 '15 at 14:54
  • It says [here](http://neo4j.com/docs/milestone/configuration-jvm.html#_configuring_heap_size_and_gc), `When using Neo4j Server, JVM configuration goes into the conf/neo4j-wrapper.conf file`, so I think you need to set heap size like this `wrapper.java.additional=-Xmx4g` – Arkantos Feb 26 '15 at 14:59
  • In a windows installation I don't appear to have that file - or even a conf directory – rick.it.2004 Feb 26 '15 at 15:45
  • Using -Xmx4g results in the error "The JVM could not be started. The maximum heap size (-Xmx) might be too large or an antivirus or firewall tool could be blocking execution". – rick.it.2004 Feb 26 '15 at 15:48
  • 1
    That error means that when you try to run java process you don't have 4GB free memory at the time of starting JVM. When you say `-Xmx4g`, JVM process will ask the host OS for 4GB block and reserve it for future use. But you said you have 16gb ram, so check if there's any other process that's taking too much memory. – Arkantos Feb 26 '15 at 16:09
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/71803/discussion-between-rick-it-2004-and-arkantos). – rick.it.2004 Feb 26 '15 at 16:21
  • I just updated my answer :) – Arkantos Feb 26 '15 at 16:35

2 Answers2

3

As per the official docs,

When using Neo4j Server, JVM configuration goes into the conf/neo4j-wrapper.conf file

So set the heap size like below in neo4j-wrapper.conf file,

wrapper.java.additional=-Xmx4g

On Windows, by default that folder and file won't exist. See this for a similar issue, you need to create that folder and that file insider your Neo4j installation directory.

You said that Using -Xmx4g results in the error The JVM could not be started. The maximum heap size (-Xmx) might be too large or an antivirus or firewall tool could be blocking execution.

That error means that when you try to run java process you don't have 4GB free memory at the time of starting JVM. When you say -Xmx4g, JVM process will ask the host OS for 4GB block and reserve it for future use. But as you already have 16gb ram, check if there's any other process that's taking too much memory.

Community
  • 1
  • 1
Arkantos
  • 6,530
  • 2
  • 16
  • 36
  • 1
    In a windows installation I don't appear to have that file - or even a conf directory – rick.it.2004 Feb 26 '15 at 15:45
  • see [this](http://stackoverflow.com/questions/25179523/where-is-conf-neo4j-wrapper-conf-on-windows-installation) for a similar issue, you need to create that folder and that file insider your Neo4j installation directory :) – Arkantos Feb 26 '15 at 16:11
  • 1
    you don't need to create the file, in windows installations there is a neo4j-community.vmoptions file in the bin directory. – rick.it.2004 Feb 26 '15 at 16:19
  • 2
    A follow up: Neo4J ships with a 32bit JRE for windows. I downloaded a 64bit JRE and use a symbolic link from the NEO4J JRE to the 64bit JRE. Neo4J fails to start with the error 'The JVM found at ..\jre is damaged. Please reinstall or define EXE4J_JAVA_HOME to point to an installed 32-bit JDK or JRE'. It seems that NEO4J only works with 32-bit, and that limits memory to 1.4G – rick.it.2004 Feb 27 '15 at 13:36
  • I just pinged on that chat you created yesterday – Arkantos Feb 27 '15 at 13:45
  • 1
    So, is there really no way around the 1.4G limit on Windows? If anyone can confirm it I'd appreciate that, so I can move on to some alternative solution (OrientDB maybe). – Parzival Apr 17 '15 at 16:54
0

As a workaround in Windows, I've been launching it as follows in command prompt "C:\Program Files (x86)\Neo4j Community\bin\neo4j-desktop-2.2.0.jar" -d64 -Xmx400g ...

jacobk
  • 11
  • 1