I have a SpringRoo-based application that runs in a production environment, which causes severe memory leaks in permg after some hot redeployments.
To “find and fix” a leak and reduce variables during analysis, I created a simple, simplified application using roo, and I get the same behavior. A project (created using Spring Roo (1.2.3.RELEASE)) simply saves an object called "Man" with a string field called "name".
I am deploying the war on Tomcat 7.0.39 using Oracle 11.2.0.2 as the database. After each redeployment, I get this message in catalina.out
INFO: Undeploying context [/ojdbc-0.1.0.BUILD-SNAPSHOT] mag 06, 2013 10:50:43 AM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc SEVERE: The web application [/ojdbc-0.1.0.BUILD-SNAPSHOT] registered the JDBC driver [oracle.jdbc.OracleDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
After two hot redeployments, I get a permg error:
mag 06, 2013 10:51:08 AM org.apache.catalina.startup.HostConfig deployWAR INFO: Deploying web application archive /Applications/apache-tomcat-7.0.39/webapps/ojdbc- 0.1.0.BUILD-SNAPSHOT.war Exception in thread "ContainerBackgroundProcessor[StandardEngine[Catalina]]" Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "ContainerBackgroundProcessor[StandardEngine[Catalina]]" Exception in thread "RMI TCP Connection(idle)" mag 06, 2013 10:51:17 AM ServerCommunicatorAdmin reqIncoming WARNING: The server has decided to close this client connection. java.lang.OutOfMemoryError: PermGen space Exception in thread "RMI TCP Connection(idle)" java.lang.OutOfMemoryError: PermGen space
I tried to analyze this using the VisualVm / EclipseMemory Analyzer, and this is what I still get.


The fact is that I do not observe this behavior with another database (for example, PostgreSQL or Hypersonic). Is there something Oracle related that is causing a leak?
Here is the zip archive containing the roo script generator, anche .hprof dump file.
source share