I have an interesting issue with Java memory consumption. I have my own C ++ application that calls my Java application.
The application mainly performs some language translations \ parses several XML and responds to network requests. Most of the state of the application should not be preserved, so it is full of methods that take String arguments and return string results.
This application continues to receive more and more memory over time, and there comes a time when it starts to take about 2 GB of memory, which made us suspect that there is a leak somewhere in some hashtable or static variables. On closer inspection, we did not find any leaks. A comparison of heap dumps over a given period of time shows that the char [] and String objects occupy a huge amount of memory.
However, when we check these char [] lines, we find that they do not have GC roots, which means that they should not be the cause of the leak. Since they are part of the heap, this means that they are waiting for garbage collection. After using the proven MAT \ VisualVM \ JHat tools and scrolling through many such objects, I used the trial version of yourkit. Immediately after this, Yourkit reports that 96% char [] and String are not available. This means that while taking the dump, 96% of the rows in the heap were expecting garbage collection.
I understand that GC works sparingly, but when you check with VisualVM, you can see how it works :-( than there are always so many unused objects in the heap.
IMO this application should never occupy more than 400-500 MB of memory, where it remains for the first 24 hours, but it continues to increase the heap: - (
Java 1.6.0-25.

.