1

When running a Corda 3 node, I get the following exception:

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

How can I increase the amount of memory available to the node?

3 Answers 3

2

You can run a node with additional memory by running the node's corda JAR from the command line with the following flag:

java -Xmx2048m -jar corda.jar

You can also specify that the node should be run with extra memory in the node's node.conf configuration file:

myLegalName="O=PartyA,L=London,C=GB"
...
jvmArgs=["-Xmx8G"]

Finally, you can specify that the node should be run with extra memory in the deployNodes task:

task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {
    directory "./build/nodes"
    node {
        name "O=Node,L=London,C=GB"
        ...
        extraConfig = [
            jvmArgs : [ "-Xmx1g"]
        ]
    }
}

See https://docs.corda.net/running-a-node.html#starting-an-individual-corda-node.

Sign up to request clarification or add additional context in comments.

3 Comments

We have tried to use this extraConfig = [ jvmArgs : [ "-Xmx1g" ] ] in the build.gradle, and the node generation seems to work fine. But when I try to start the node, I receive the following error: [ERROR] 13:01:06-0200 [main] internal.Node.run - Unknown configuration keys: [jvmArgs]. In node.conf, the snippet is jvmArgs=[ "-Xms2G", "-Xmx8G" ]. What is the correct approach to get this node memory configuration working ?
It works for me. If in deployNodes I add extraConfig = [ jvmArgs: [ "-Xms2G", "-Xmx8G" ]], the node.conf gets jvmArgs=["-Xms2G", "-Xmx8G"] and the node runs successfully.
Quicksilver:Test vfalcao$ java -jar corda.jar --version Corda Enterprise Edition 3.1 Revision c9b23a4400923a5cfe88271ce2fedd75740eac40 Platform Version 3 Quicksilver:Test vfalcao$ java -jar corda.jar [ERROR] 13:01:06-0200 [main] internal.Node.run - Unknown configuration keys: [jvmArgs]. -- I still got the error. Any pointers for get us in the right direction ?
1

Adding extraConfig in Gradle's Cordform task worked for me with Corda Enterprise 4.2:

task deployNodes(type: net.corda.plugins.Cordform) {
    nodeDefaults {
        // ...
        extraConfig = [ custom: [jvmArgs: [ "-Xms8G", "-Xmx8G", "-XX:+UseG1GC" ]] ]
    }
    // ...
}

The resulting node.conf fragment is:

custom {
    jvmArgs=[
        "-Xms8G",
        "-Xmx8G",
        "-XX:+UseG1GC"
    ]
}

Comments

0

Adding following block in "task deployNodes" section worked for me -

extraConfig = [ jvmArgs : [ "-Xmx1g"] ]

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.