我在Clojure中創建了一個Web應用程序,將它打包爲WAR,並將其部署在Tomcat上。它的工作原理如我所料,但是當我去關閉Tomcat,我看到很多例外如下所示:Clojure Web應用程序中的內存泄漏
SEVERE: The web application [] created a ThreadLocal with key of type
[java.lang.ThreadLocal] (value [[email protected]]) and a value of type [clojure.lang.LockingTransaction] (value [[email protected]]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
Mar 17, 2011 4:19:48 AM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: The web application [] created a ThreadLocal with key of type [null] (value [[email protected]]) and a value of type [clojure.lang.Var.Frame] (value [[email protected]]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
Mar 17, 2011 4:19:48 AM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: The web application [] created a ThreadLocal with key of type [null] (value [[email protected]]) and a value of type [clojure.lang.Var.Frame] (value [[email protected]]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
我明白有些事情的Clojure做,可能會有點超前Java垃圾收集器在倍。我的戰爭確實有一個ServletContextListener,它啓動了幾個後臺線程,但是我沒有看到爲什麼這些上下文不會被正常終止(畢竟它們不是守護線程)。
有沒有更好的/不同的方式,我應該用它來啓動我的線程,這對Tomcat更友好?現在我只是打電話給(future (loop ...
。
是的,當JVM完全關閉時,這當然不是問題。當我將WAR的新版本部署到現有的,運行的Tomcat實例時,我想這個問題會更多 - 當然,它不利於舊的,發出警告,然後啓動並啓動新的WAR。我擔心那些泄露的東西在新版本的WAR出現之後仍然存在...... – 2011-03-17 17:45:22