I have a java application that has a weird memory usage, I noticed that the memory consumption is significantly higher than the max heap size (Xmx
is 800m
, usage is 1.4g
).
One of the recent changes preceding this was a large increase in the unique strings in use, so I thought maybe the many strings I have use a lot of memory outside the heap - is this possible?
I'm running java 11.
EDIT:
for example, in this article it mentions:
When we create a String object using the new() operator, it always creates a new object in heap memory. On the other hand, if we create an object using String literal syntax e.g. “Baeldung”, it may return an existing object from the String pool, if it already exists.
Giving the impression of 2 different areas - the heap and the string pool.