Search code examples
micronaut

How can i limit memory of my micronaut server app


I am running a small webserver-app using micronaut.

This is how i start it.

nohup ./jdk-15/bin/java -jar microtao-0.1-all.jar>./microtao.log &

I think it uses too much memory.

ps aux --sort=-%mem | head
root      7818  0.1  1.0 4727872 89732 pts/1   Sl   13:55   0:08 ./jdk-15/bin/java -jar microtao-0.1-all.jar

How can I limit the memory to 500 mb?


Solution

  • You could specify the max heap size for the JVM...

    java -Xmx512m -jar microtao-0.1-all.jar