Similar to java.lang.OutOfMemoryError ( PermGen space) and java.lang.ClassNotFoundException at the opening the jsp page but with slightly more modern problems.
I have a legacy app which has a lot of JSPs. Some of them use ...
to do the spaces (as a CSS cleanup on the page wasn't done yet).
Recently we've been getting out of memory errors after the system has been running for a while. I was evaluating the heap space and it seems under control, forcing periodic GCs show that it is less than 100MBs of heap, but the non-heap size is increasing. I have capped the size to 300MBs which seems like a lot already as the system generally runs at 512MB in Docker.
Anyway, I use JSPC and when I totalled the amount of bytes all the generated class files take up I get 21,981,012 bytes. which I take it goes into metaspace based on other answers I have seen. Of course that number is likely increased by a large portion as it is unpacked into memory.
So my question is, is there a way to configure Java or Tomcat to release class data from metaspace when it is not in use and reload it later if needed?
UPDATE: I explicitly limited the metaspace size in my CATALINA_OPTS
so that it will fail faster -XX:MaxMetaspaceSize=200m -XX:CompressedClassSpaceSize=100m
Here is the VisualVM. The classes do not seem to get unloaded and the metaspace does not go down either.