Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ParserConfig可能导致内存溢出 #1934

Open
sdmeml opened this issue Jun 30, 2018 · 2 comments

Comments

Projects
None yet
3 participants
@sdmeml
Copy link

commented Jun 30, 2018

版本1.2.44,
老年代配置了500多mb内存,基本被ParserConfig吃光,
其属性deserializers占用内存特别高。
其中占用最高的是FeildInfo这个类
我查看dump日志,deserializers里
com.alibaba.fastjson.util.IdentityHashMap$Entry嵌套一层又一层,
每层进去查看com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer
的FeildInfo和上层都是一样的。
我定义的类
public class DefaultPageable<T extends DefaultPageable>
其中有方法
public T setTotalSize(java.lang.Integer){
//xxxxxx
return (T)this;
}
我发现n多setTotalSize的FeildInfo。
初步怀疑,set方法返回值如果是本身的话,可能无限吃内存

@wenshao

This comment has been minimized.

Copy link
Member

commented Jun 30, 2018

升级到1.2.47试试看?

@fireinjava

This comment has been minimized.

Copy link

commented Jan 16, 2019

升级到1.2.47试试看?

我也碰到这问题。我fastjson是1.2.54的,不过在另一个文章里面看到温少提示要缓存第二个参数后一语惊醒,改下就好了
Base<XXX> obj = JSON.parseObject(message, new TypeReference<Itg<QuotationDetail>>() { }); 改成 Base<XXX> obj = JSON.parseObject(message, Constants.TYPE_REFER_XXX);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.