thomas
thomas

Reputation: 310

Too many instances of "com.mysql.jdbc.JDBC4Connection"

Used memory of the server has been increasing. I suspect a memory leak here. And when I had a look on the heap dump, I see too many instances of "com.mysql.jdbc.JDBC4Connection" loaded in the memory. Wherever I am using the connection, I am closing the connection, resultset and prepared statement. Am I doing something wrong ?

5,576 instances of "com.mysql.jdbc.JDBC4Connection", loaded by "sun.misc.Launcher$AppClassLoader @ 0x68001f718" occupy 165,513,640 (55.60%) bytes. 
Keywords
com.mysql.jdbc.JDBC4Connection
sun.misc.Launcher$AppClassLoader @ 0x68001f718

Upvotes: 1

Views: 971

Answers (1)

user3359139
user3359139

Reputation: 478

I am sure you didn't close the connection some where. Please carefully review your code again. However, if you fail to resolve the problem, try to use a connection pooling mechanism like this: https://devcenter.heroku.com/articles/database-connection-pooling-with-java

Upvotes: 1

Related Questions