0
votes

My cordApp is using a 3rd party service that require more heap space but i am unable to increase the heap size limit while running it from IntelliJ IDEA. I have seen following docs:

https://docs.corda.net/running-a-node.html

but i want more heap space while i run my app on mock network from intellij IDE. I have tried following solutions:

  1. Setting VM Option -Xmx1048m in run configrations
  2. Editing idea.vmoptions
  3. (Mac) Changing Preferences > Build,Execution,Deployment > Compiler [params]
  4. (Mac) Changing Preferences > Build,Execution,Deployment > Compiler > Kotlin Compiler [params]

Every time i run

Runtime.getRuntime().maxMemory()

i get heapsize of around 209715200 bytes (209 MBs)

Edit:

idea.vmoptions file

-Xms1g
-Xmx4g
-XX:ReservedCodeCacheSize=240m
-XX:+UseCompressedOops
-Dfile.encoding=UTF-8
-XX:+UseConcMarkSweepGC
-XX:SoftRefLRUPolicyMSPerMB=50
-ea
-Dsun.io.useCanonCaches=false
-Djava.net.preferIPv4Stack=true
-XX:+HeapDumpOnOutOfMemoryError
-XX:-OmitStackTraceInFastThrow
-Xverify:none

-XX:ErrorFile=$USER_HOME/java_error_in_idea_%p.log
-XX:HeapDumpPath=$USER_HOME/java_error_in_idea.hprof
-Xbootclasspath/a:../lib/boot.jar

1
Can you post the contents of the idea.vmoptions file please? Sounds like this isn't a Corda specific problemCais Manai
I am using corda V2 and i think i cannot change individual node heapsize as v2 corda.jar is compiled with VM-Args: Xmx200m. I cloned a fresh copy of V3 github.com/corda/cordapp-example planning to try docs.corda.r3.com/api/kotlin/corda/net.corda.testing.driver/…Omer Shafiq
@OmerShafiq Why do we need heap during compiling the code ?Shailesh Pratapwar
@Shinchan i added a third party dependency to my build.gradle and my cordApp compiles and starts absolutely fine but when i start a corda flow, In my example 'Create an IOU' it throws exception of going out of memory (heap space). *NOTE I am not using any functionality of the newly included dependency.Omer Shafiq
With V2 cordapp-example everything works fine after updating build.gradle with new dependency but when i try to access functions of the newly included dependency i get following: java.lang.IllegalArgumentException: System memory 209715200 must be at least 471859200. Please increase heap sizeOmer Shafiq

1 Answers

2
votes

I used Corda V3 and updated NodeDriver.kt and it worked for me

fun main(args: Array<String>) {
// No permissions required as we are not invoking flows.
val nodeParams = NodeParameters(maximumHeapSize = "800m")
val user = User("user1", "test", permissions = setOf("ALL"))
driver(DriverParameters(isDebug = true, waitForAllNodesToFinish = true)) {
    val (partyA, partyB, partyC) = listOf(
            startNode(nodeParams, providedName = CordaX500Name("PartyA", "London", "GB"), rpcUsers = listOf(user), maximumHeapSize = "800m"),
            startNode(nodeParams, providedName = CordaX500Name("PartyB", "New York", "US"), rpcUsers = listOf(user), maximumHeapSize = "800m"),
            startNode(nodeParams, providedName = CordaX500Name("PartyC", "Paris", "FR"), rpcUsers = listOf(user), maximumHeapSize = "800m")).map { it.getOrThrow() }
    startWebserver(partyA,"800m")
    startWebserver(partyB,"800m")
    startWebserver(partyC,"800m")
}}