I have a Java application built on the Quarkus framework. Immediately after deploying the application, it consumes a significant amount of direct buffer memory. As illustrated in the screenshot, the jvm_buffer_total_capacity_bytes metric indicates that approximately up to 2.5 gigabytes of memory are in use, even when the CPU is idle, and there are hardly any incoming requests.
However, when the application becomes more active, here after 23:00, and the garbage collector begins its hard work, the jvm_buffer_total_capacity_bytes metric drops to just a few megabytes.
On another run, I've used jcmd VM.native_memory to check the native memory diff. Compared to base line taken after a few minutes after start and the highest usage the output is
[0x00007fd60cd53d71] Unsafe_AllocateMemory0+0x81
[0x00007fd5f47d9861]
(malloc=859648KB type=Other +777122KB #2750 +2443)
My question is, why is there a high usage of direct buffer memory when the application is not experiencing a heavy load?
Settings:
OpenJDK 64-Bit Server VM Corretto-21.0.0.35.1 (build 21+35-LTS, mixed mode, sharing)
-Xms8000M -Xmx8000M -XX:+UseG1GC
with java flight recorder enabled
