I know this is a question already discussed, but I couldn't find a method to get peace of mind.
Basically we have a java web application that runs under a tomcat application server, specifically:
- Java HotSpot(TM) 64-Bit Server VM; 1.8.0_112; 25.112-b15; mixed mode
- Tomcat 7.0_Tomcat7.0.73
- Windows Server 2012 R2 (6.3.9600)
Our application is becomind too much memory hungry, so we're starting to profile it; but I can't understand a simple difference I see between application memory consumption (heap/non-heap) and memory on the OS:
Here the memory is 4.1 Gb (Heap committed) plus 660 Mb (Non heap, so Metaspace, code cache, compressed class space), so 4.7 Gb total
Here I see 6.266 Gb of memory actively used by the Tomcat process
How can I measure this 1.5 Gb difference?
Is it just for the Tomcat application itself? The JVM runtime? If so, how I can measure it?
Edit: this difference seems to grow over time after the application server (Tomcat) start; initially the sum of Heap/Non Heap is quite close to the memory used by the Tomcat process as recorded by the OS, then after hours/days in tends to grow.
Edit 2: our JAVA options in the Tomcat server
-Xms512m -Xmx6144m -Dlog=production -DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector -Djava.util.Arrays.useLegacyMergeSort=true -Duser.country=IT -Duser.language=it -XX:+UseG1GC -XX:+UseStringDeduplication