Mar 18, 2010 11:13:07 PM org.apache.catalina.core.ApplicationContext log INFO: HTMLManager: stop: Stopping web application at '/testWeb' Mar 18, 2010 11:13:07 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads SEVERE: A web application appears to have started a thread named [leakingThread] but has failed to stop it. This is very likely to create a memory leak.
public class LeakingServlet extends HttpServlet { private Thread leakingThread; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { if (leakingThread == null) { synchronized (this) { if (leakingThread == null) { leakingThread = new Thread("leakingThread") { @Override public void run() { synchronized (this) { try { this.wait(); } catch (InterruptedException e) { e.printStackTrace(); } } } }; leakingThread.setDaemon(true); leakingThread.setContextClassLoader(null); leakingThread.start(); } } } response.getWriter().println("Hello world!"); } }需要把子线程的classloader设置为空(eakingThread.setContextClassLoader(null);),
不受主线程的管理,当tomcatstop的时候就不会检测
内存泄露了。
http://wiki.apache.org/tomcat/MemoryLeakProtection#cclThreadSpawnedByWebApp
相关推荐
memory leak 教程,一步一步解决内存泄漏。
This program is a tool that help you positioning memory leak locations of an QUALCOMM BREW application on simulator. It can give the call stack of memory leaks (including the locations that MALLOC/...
一个在模拟器上定位BREW应用程序内存泄露位置的工具,可以给出内存泄露位置的调用栈信息(包括MALLOC、REALLOC分配的内存,也能定位到调用ISHELL_CreateInstance的位置)
本文中描述了C++中常见的内存泄露,以及对应的解决方法,并且介绍了几种常见的内存泄露检查工具的使用(常见的工具只有vld和codesnitch)
memory leak tools for android memory leak tools for android
Memory leak detection for WinCE
检测内存泄漏的工具源码 三个文件 使用时只要include一个头文件就可以 内含一个example程序
内存泄露(memory leak)资料,网上收集的,感谢原作者
C++ memory leak detection and exception
This program is a tool that help you positioning memory leak locations of an QUALCOMM BREW application on simulator. It can give the call stack of memory leaks (including the locations that MALLOC/...
有关flex 内存泄漏memory leak介绍的ppt. flash player的内存泄漏实在搞的我头大了
使用__wrap_malloc查找malloc导致内存泄漏问题 memory leak 内存泄漏
A Practical FlowSensitive and ContextSensitive C and C++ Memory Leak Detector
This document is about Memory leak.
技術分享_Glassfish 3.1.2.2 Web Service Memory Leak Workaround1
java -verbose:gc -Xloggc:gc.log -XX:+ PrintGCDetails -jar Learn-tomcat-memory-leak-0.0.1-SNAPSHOT.jar 使用jstat命令观察GC的过程 jstat -gc 94223 2000 1000 通过GCViewer工具查看GC日志 为了找到内存泄漏...
内存泄漏检测器 MemoryLeakDetector是由Xigua视频android团队开发的本地内存泄漏监视工具。 它具有访问简单,监视范围广,性能...leak-detector:0.0.7 '} 步骤3:添加代码以方便使用(使用广播控件不需要此步骤) //
Converting a bitmap to a region - memory leak fix将位图转化为一个区域 - 修补了内存漏洞(179KB)
Converting a bitmap to a region - memory leak fix将一个位图转换成一个区域--内存泄露的修正(4KB)