Skip to content

Instantly share code, notes, and snippets.

@svennela
Last active July 10, 2020 05:01
Show Gist options
  • Select an option

  • Save svennela/d12c551e1fa640cd39ebcf5fa5738bd0 to your computer and use it in GitHub Desktop.

Select an option

Save svennela/d12c551e1fa640cd39ebcf5fa5738bd0 to your computer and use it in GitHub Desktop.
java -Xms64m -Xmx64m -jar target/demo-0.0.1-SNAPSHOT.jar
For example, to set the heap size for our application to be of size 2GB we would add -Xms2g -Xmx2g to
our application startup parameters. In most cases, I would also set them to the same value to avoid
heap resizing and in addition to that I would add the -XX:+AlwaysPreTouch flag as well
to load the memory pages into memory at the start of the application.
https://sematext.com/blog/java-garbage-collection-tuning/
http://khaidoan.wikidot.com/java-performance-tuning
https://www.toptal.com/java/hunting-memory-leaks-in-java#memleak
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment