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