如何解决内存泄漏问题? [英] How to solve memory leak problems?

查看:893
本文介绍了如何解决内存泄漏问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一些线程和内存泄漏的问题......在我的Tomcat7的日志中,我发现了关于我的grails应用程序的这一行:

I have a problem with some thread and memory leak...In the log of my Tomcat7 I found this lines about my grails application:

SEVERE: The web application [/myApp] appears to have started a thread named [MySQL Statement Cancellation Timer] but has failed to stop it. This is very likely to create a memory leak.
May 16, 2012 6:02:10 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/myApp] appears to have started a thread named [pool-63-thread-1] but has failed to stop it. This is very likely to create a memory leak.
May 16, 2012 6:02:10 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/myApp] appears to have started a thread named [pool-63-thread-2] but has failed to stop it. This is very likely to create a memory leak.
May 16, 2012 6:02:10 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/myApp] appears to have started a thread named [pool-63-thread-3] but has failed to stop it. This is very likely to create a memory leak.
May 16, 2012 6:02:10 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/myApp] appears to have started a thread named [pool-63-thread-4] but has failed to stop it. This is very likely to create a memory leak.
May 16, 2012 6:02:10 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/myApp] appears to have started a thread named [pool-63-thread-5] but has failed to stop it. This is very likely to create a memory leak.
May 16, 2012 6:02:10 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/myApp] appears to have started a thread named [pool-63-thread-6] but has failed to stop it. This is very likely to create a memory leak.
May 16, 2012 6:02:10 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/myApp] appears to have started a thread named [pool-63-thread-7] but has failed to stop it. This is very likely to create a memory leak.

以及更多这些...
问题是我认为所有这些线程是由第三方JAR开发的应用程序的一部分创建的,我没有源代码,我无法自行修改。

and more of those... The problem is that I think that all those threads are created in a part of the application developed from a 3th party JAR which I don't have the source and I can't modify by myself.

有没有办法解决它,或至少了解什么是不好?

Is there a way to solve it, or at least to understand what is not going well?

谢谢

thanks

推荐答案

第一行表示MySQL JDBC驱动程序中的一个错误。看起来它已在5.1.6中修复 - 请参阅 http://bugs.mysql.com/ bug.php?id = 36565 ,所以你可以尝试用 http://dev.mysql.com/downloads/connector/j/

The first line indicates a bug in the MySQL JDBC driver. Looks like it's been fixed in 5.1.6 - see http://bugs.mysql.com/bug.php?id=36565 so you could try replacing the jar with the latest from http://dev.mysql.com/downloads/connector/j/

其他行表示一个已启动的ThreadPool,并且在申请停止。
这真的只能通过修改第三方jar的源代码来解决,如果问题出在这里的话。

The other lines indicate a ThreadPool that was started, and not stopped when the application stops. This can really only be fixed by modifying the source code of the third-party jar, if that is where the problem is.

如果可能的话,你可以尝试暂时消除第三方jar,以查看问题是否消失。

If possible, you could try temporarily eliminating the third-party jar to see if the issue goes away.

这篇关于如何解决内存泄漏问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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