1

如果在我的 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服务器。

4

0 回答 0