When using Neo4j embedded with Java how do I increase the size of the heap past 2 gigabytes?
I tried to increase it to 4 Gigabytes using
GraphDatabaseService graphDb = new GraphDatabaseFactory()
.newEmbeddedDatabaseBuilder(new File("C:\\...\\graph.db"))
.setConfig(GraphDatabaseSettings.pagecache_memory, "4096M")
.newGraphDatabase();
as noted in manual but this appears to have no effect on the size of the heap, e.g.
Max: 2,124,414,976 B in image below.
Details
In doing a uniform cost search or lowest cost first search requires retaining
- A list of each node visited
- A queue of the cost for each relationship not processed
In using Neo4j embedded with Java the application ends with
java.lang.OutOfMemoryError: GC overhead limit exceeded
To monitor the application running it is run with IntelliJ Community 2018.3 in debug mode with Visual VM 1.4.2.
The IntelliJ Plugin VisualVM Launcher is installed.
EDIT
This helps get past the problem for testing but still does not answer the question. It is posted here so that it can help others that find this question.
While I currently can not find a way increase the heap size for the JVM when creating a Neo4j graph with the Neo4j Java API, e.g.
new GraphDatabaseFactory()
or
new EnterpriseGraphDatabaseFactory()
when testing using IntelliJ
by creating the graph using
GraphDatabaseService graphDb = new GraphDatabaseFactory()
.newEmbeddedDatabase(new File("C:\\...\\graph.db"));
and using the Intellj Run/Debug Configurations Dialog
and editing VM options
by adding the JVM configuration options for starting heap size Xms
and maximum heap size Xmx
e.g.
-Xms4096m -Xmx4096m
the heap was increased during testing to 4,4294,967,296 B and the program completed as expected.