Hello All;
I am using Spring MVC version 5.3.29 with Hibernate version 5.6.15.Final, and I am getting Out of Memory Because Error Compressed Class Space although I set the size to be 3g using the argument -XX:CompressedClassSpaceSize=3g. In order to detect where is the memory leak happening and which class is keep loaded again and again, so I added the following argument for JVM: -Xlog:class+load=info and we discovered that there are some classes which are hibernate model classes (classes defined to be mapped to the tables) are loaded and loaded again (based on the below obtained
tomcat log). Please note that we are using session.createNativeQuery recently and some queries are still session.createSQLQuery.
In the hibernate model classes (that I created), I imported the following:
I am closing the sessions using session.flush(), session.clear(), session.close() and session.getSessionFactory().close().
Moreover, I am using the below hibernate dependency:
Please see the below results of the class-load logs which contains "__JVM_DefineClass__":
And ofcourse, the Compressed Class Space is keep increasing until I reach for out of memory.
Tomcat version is 9
JDK version is 17.
Operating System is Linux Ubuntu Server version 22.04.2 LTS
Appreciate the kindly help please.
Regards
Bilal