We didn't find memory leaks in JVx, but sometimes memory consumption is higher than expected. We tried a lot of settings and profiling tools to find problems in JVX, without success. In the end we configured the gc to free memory reliable. With one of our JVM settings, application server memory consumption is as expected:
-XX:+UseG1GC -XX:+UnlockExperimentalVMOptions -XX:+UseStringDeduplication -XX:InitiatingHeapOccupancyPercent=1
This will release all the memory sooner or later even when idle (8 minutes)
-XX:+UseZGC -XX:+ExplicitGCInvokesConcurrent -XX:ZCollectionInterval=30
-XX:+UseZGC -XX:+ZGenerational -XX:+UnlockExperimentalVMOptions -XX:+ExplicitGCInvokesConcurrent -XX:+ZProactive -XX:ZCollectionInterval=30
Use following statement in your postgres database to get a list of setval statements which will set the sequences to the max value.
SELECT t.table_name, 'SELECT setval(''seq_'|| t.table_name || '_id'', max(id)::integer) FROM ' ||t.table_name FROM information_schema.tables t WHERE table_schema = 'public' AND table_type = 'BASE TABLE';