"com.mysql.jdbc.JDBC4Connection"实例过多. [英] Too many instances of "com.mysql.jdbc.JDBC4Connection"

查看:515
本文介绍了"com.mysql.jdbc.JDBC4Connection"实例过多.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

服务器的已用内存正在增加.我怀疑这里有内存泄漏.当我查看堆转储时,发现内存中加载了太多的"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

推荐答案

我确定您没有在某些地方关闭连接.请再次仔细检查您的代码.但是,如果无法解决问题,请尝试使用如下连接池机制: https://devcenter.heroku.com/articles/database-connection-pooling -with-java

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

这篇关于"com.mysql.jdbc.JDBC4Connection"实例过多.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆