Can I pass JVM parameters to a `daml` sub-command?

In my case I want to increase available heap size for the HTTP JSON API. Is there a way to pass -Xmx2g to the process?

The easiest option is probably via environment variables. Something like

JAVA_TOOL_OPTIONS="-Xmx2g" daml sandbox

should work…

2 Likes

I’ve tried to use the Windows variant of ^ but to no avail. What is the ultimate java command that’s being run? Maybe I can try passing it into that directly.

The other possibility is that somehow my model has an issue. I’m uploading two DARs to the ledger, both ~1mb in size. It works with just one, but not with both. But I can’t see anything that would require large memory usage for the HTTP JSON API in the second package.

On linux the command looks something like this

java -Dlogback.configurationFile=/home/moritz/.daml/sdk/1.18.0-snapshot.20211019.8113.0.8ff347d8/daml-sdk/json-api-logback.xml -jar /home/moritz/.daml/sdk/1.18.0-snapshot.20211019.8113.0.8ff347d8/daml-sdk/daml-sdk.jar json-api --ledger-host localhost --ledger-port 6865 --http-port 7575

You’ll have to adjust the path on Windows. The SDK is installed into %appdata%/daml iirc.

My recommendation would be to try reproducing this with the standalone JSON API jar from GH releases which is probably easier than trying to go down that route. I’m slightly sceptical though that memory usage is the issue. As far as I know we don’t impose any memory limits and iirc the JVM doesn’t enforce any by default either.