"com.mysql.jdbc.JDBC4Connection"实例过多.

编程入门 行业动态 更新时间:2024-10-26 12:35:37
本文介绍了"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

推荐答案

我确定您没有在某些地方关闭连接.请再次仔细检查您的代码.但是,如果无法解决问题,请尝试使用如下连接池机制: 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"实例过多.

本文发布于:2023-11-25 12:17:17,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1629716.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:实例   mysql   quot   JDBC4Connection   jdbc

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!