Notice:

This page has been converted from a dynamic Wordpress article to a static HTML document. As a result, some content may missing or not rendered correctly.

Oracle JDBC PermGen Memory Leak Fix ~ Wed, 08 Jan 2014 15:31:34 +0000

Let's talk about the Oracle JDBC drivers. If you have had the misfortune to use them, you know that there are many ways they can taint your well written application. For me, the most annoying problem is the memory leaks they leave behind when you redeploy an application without shutting down the JVM instance. Do this enough, and the drivers end up using all of the PermGen space and necessitating a restart of the JVM (undesirable when your JVM is really a web server running multiple applications). This problem has plagued me for a couple of years, and I think I have finally figured out the solution. I wrote that solution into a library I call SimpleOraclePool.

SimpleOraclePool takes care of creating a connection pool using the Oracle UCP library with the Oracle JDBC driver providing the connection. Included in the library is a ServletContextListener, named OjdbcDriverListener, that will clean up the Oracle mess when your application is unloaded (from a Servlet container, of course).

I'll leave out the explanation of how to use it. That is all documented in the code repository's readme and the JavaDoc included with the library. But I would like to sign this post with a message to Oracle:

....................../´¯/) 
....................,/¯../ 
.................../..../ 
............./´¯/'...'/´¯¯`·¸ 
........../'/.../..../......./¨¯\ 
........('(...´...´.... ¯~/'...') 
.........\.................'...../ 
..........''...\.......... _.·´ 
............\..............( 
..............\.............\...
Code,  Java,  Oracle,  Technology