Issue
I am building a javafx project with scala and I have noticed that the memory usage is over 170mb and a blank javafx project is about 90mb. I saw the JavaFX eats my memory? page and it says that most of the memory in the heap is not being used an explains a way to shrink the heap by using this flag: --XX:+UseG1GC. I tried this in sbt by using: javacOptions += "--XX:+UseG1GC" In Sbt but the memory usage stayed the same. Can anybody help me shrink this heap?
Solution
If you use SBT native packager in you project, in addition to JVM_OPTS
and .jvmopts
you may add flags (or some other custom commands) to a generated execution script. That's how we do it in our project:
project.in(file("example")).settings(
batScriptExtraDefines ++= Seq( //Windows bat/cmd
"""set _JAVA_OPTS=!_JAVA_OPTS! -Djdk.tls.ephemeralDHKeySize=2048""",
"""set _JAVA_OPTS=!_JAVA_OPTS! -Djdk.tls.rejectClientInitiatedRenegotiation=true"""
),
bashScriptExtraDefines ++= Seq( //Unix shell
"""addJava "-Djdk.tls.ephemeralDHKeySize=2048"""",
"""addJava "-Djdk.tls.rejectClientInitiatedRenegotiation=true"""",
"""umask 077"""
)
)
Answered By - den_po