Big memory footprint of Hilla using Spring Boot + Jdk17

Hello, from the JVM default of allocating 4.5GB of RAM on a 8GB RAM machine I was able to get down to ~0.9-1GB of memory consumption for a quite simple app. I was expecting more like 100-200MB (extra to heap and metaspace). Are there any recommendations for this?

That already includes reducing heap very much and reducing metaspace a lot. It appears that java takes ~700MB from those ~900MB.

-jar app.jar

It is a Fedora 36 Linux box

Is there a better experience with Eclipse Temurin JDK, or IBM Semeru/OpenJ9?

I had almost no improvement with jlink

Native images?

Have you profiled the app, any clear indication on what’s using that much memory?

Hello, I am not unhappy with the heap and metaspace consumption, what worries me that jvm reserves 900 MB in total

VmPeak: 986900 kB
VmSize: 986900 kB

Resident memory is much lower

VmHWM: 135744 kB
VmRSS: 131660 kB

Do you think profiling would help?

Well I see it is not a Hilla problem, I am just curious if you have a solution for that. Even a simple do nothing Java app reserves that much RAM…

Java loves RAM :slightly_smiling_face: you can find more information about tuning here

True, I just do not see how discontinued jrockit vm docs are relevant to this. I ofc have looked into oracle jvm parameters, still stuck around 700mb + 200mb heap and meta.

So with a simple app
public class MemTest {
public static void main(String args) throws java.lang.Exception {;

With -Xms50m -Xmx150m -XX:MaxMetaspaceSize=50m I got to 1.153 GB reserved RAM

Using switches and jlink custom jdk it went down to 0.825 GB

Seems that Java is unsuitable for small apps in general