Json-lib OOM错误

错误:

The web application [/myProject] created a ThreadLocal with key of type 

[net.sf.json.AbstractJSON.CycleSet] (value [net.sf.json.AbstractJSON$CycleSet@19c0634b]) 

and a value of type [java.lang.ref.SoftReference] (value [java.lang.ref.SoftReference@392d144]) 

but failed to remove it when the web application was stopped. 

This is very likely to create a memory leak.

参考:

http://sourceforge.net/tracker/index.php?func=detail&aid=3192635&group_id=171425&atid=857928

引用:

This memory leak was confirmed, at least in 2.2.2 in Jboss 4/Tomcat. A similar ThreadLocal object used. In a multi-user environment (Jboss/Tomcat) , this will cause on HashSet to be created by user. As threads are resused, the HashSet are never flushed causing OOM errors.
查看tomcat 6.0日志(catalina.out),发现全是这个错误,找了下原来是 Json-lib 的一个已知bug:

在多用户环境下,会引起连接用户创建HashSet对象,但是线程结束后却不会自动回收因而导致OOM(out of memory)错误。

另见:(关于PermGen space,Permanent Generation space

http://thinkinginsoftware.blogspot.com/2011/01/memory-leaks-outofmemoryerror-permgen.html

http://lzrzhao.iteye.com/blog/428836

你可能感兴趣的:(json,oom,memory,json-lib,leak)