I have a Java web server running as a Windows service. I use Tomcat 8 with Java 1.8.* For a few months now, I've detected that the memory usage is increasing quite rapidly. I cannot make up for sure if it's heap or stack. The process starts with ~200MB and after a week or so, it can reach up to 2GB. Shortly after it will generate OutOfMemory exception (the memory usage will be 2GB - 2.5GB). This has repeated multiple times on multiple environments.
I would like to know if there's a way to monitor the process and view it's internal memory usage, even to the level of viewing which objects are using the most amount of memory. Can 'Java Native Memory Tracking' be used for this? This will help me to detect any memory leaks that might cause this.
Thanks in advance.