Joel
Joel

Reputation: 23150

Java OutOfMemoryError in Corda 3

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?

Upvotes: 1

Views: 534

Answers (3)

Manos Batsis
Manos Batsis

Reputation: 92

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"
    ]
}

Upvotes: 1

devman
devman

Reputation: 504

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

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

Upvotes: 0

Joel
Joel

Reputation: 23150

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.

Upvotes: 2

Related Questions