如何java ThreadLocal解决内存泄漏问题

时间:2016-03-02 08:54:29

标签: java tomcat memory-leaks performance-testing oval

如果在我的java项目中使用Oval库进行json输入验证,我会收到内存泄漏警告:

org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [rision] created a ThreadLocal with 
  key of type [net.sf.oval.internal.util.ThreadLocalLinkedList] (value [net.sf.oval.internal.util.ThreadLocalLinkedList@2c215899]) 
  and a value of type [java.util.LinkedList] (value [[]]) but failed to remove it when the web application was stopped. 
Threads are going to be renewed over time to try and avoid a probable memory leak.

我正在使用以下代码片段来改变我的json输入:

            Validator validator = new Validator();
            violations = validator.validate(object);
            if (violations.size() > 0) {
                String message = violations.get(0).getMessage();
                throw new InvalidInputException(message);
            }

如何解决椭圆引用的内存泄漏问题?我正在使用tomcat服务器。

0 个答案:

没有答案
相关问题