服务器的已用内存正在增加.我怀疑这里有内存泄漏.当我查看堆转储时,发现内存中加载了太多的"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推荐答案
我确定您没有在某些地方关闭连接.请再次仔细检查您的代码.但是,如果无法解决问题,请尝试使用如下连接池机制: devcenter.heroku/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: devcenter.heroku/articles/database-connection-pooling-with-java
更多推荐
"com.mysql.jdbc.JDBC4Connection"实例过多.
发布评论