fastjson heap out of memory error

p8ekf7hl  于 2021-11-27  发布在  Java
关注(0)|答案(1)|浏览(404)

Fastjson memory cannot be released when serialization and deserialization are used frequently.

This is heap dump

Fastjson version is: 1.2.61

num     #instances         #bytes  class name (module)
-------------------------------------------------------
   1:       4056166      356942608  java.lang.reflect.Method (java.base@11.0.2)
   2:       4054551      324364080  com.alibaba.fastjson.util.FieldInfo
   3:       4054754      291942288  java.lang.reflect.Field (java.base@11.0.2)
   4:       8032954      282960280  [B (java.base@11.0.2)
   5:       8027949      192670776  java.lang.String (java.base@11.0.2)
   6:       3998911      160200152  [Ljava.lang.Object; (java.base@11.0.2)
   7:       4055697      141276896  [C (java.base@11.0.2)
   8:       5786627      138878928  [Ljava.lang.reflect.Type; (java.base@11.0.2)
   9:       3464545      138581800  sun.reflect.generics.repository.MethodRepository (java.base@11.0.2)
  10:       3464545      110865440  sun.reflect.generics.tree.MethodTypeSignature (java.base@11.0.2)
  11:       3378711      108118752  com.alibaba.fastjson.parser.deserializer.DefaultFieldDeserializer
  12:       3993707       95848968  java.util.ArrayList (java.base@11.0.2)
  13:       3992937       95830488  sun.reflect.generics.tree.SimpleClassTypeSignature (java.base@11.0.2)
  14:       3992937       95829672  [Lsun.reflect.generics.tree.TypeArgument; (java.base@11.0.2)
  15:       3464573       83149752  sun.reflect.generics.factory.CoreReflectionFactory (java.base@11.0.2)
  16:       3464545       83149080  sun.reflect.generics.scope.MethodScope (java.base@11.0.2)
  17:       3464545       83148928  [Lsun.reflect.generics.tree.TypeSignature; (java.base@11.0.2)
  18:        823165       72438520  com.alibaba.fastjson.util.JavaBeanInfo
  19:        823833       65906640  java.lang.reflect.Constructor (java.base@11.0.2)
  20:       4055444       64987312  [Ljava.lang.String; (java.base@11.0.2)
  21:       3992937       63886992  sun.reflect.generics.tree.ClassTypeSignature (java.base@11.0.2)
  22:       3992806       63884896  sun.reflect.generics.tree.TypeVariableSignature (java.base@11.0.2)
  23:       1646343       61137040  [Lcom.alibaba.fastjson.util.FieldInfo;
  24:       1646330       61135840  [Lcom.alibaba.fastjson.parser.deserializer.FieldDeserializer;
  25:       3464574       55433392  [Lsun.reflect.generics.tree.FormalTypeParameter; (java.base@11.0.2)
  26:       3464573       55433384  [Lsun.reflect.generics.tree.FieldTypeSignature; (java.base@11.0.2)
  27:        823158       46096848  com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer
  28:        675717       27028680  com.alibaba.fastjson.parser.deserializer.ArrayListTypeFieldDeserializer
  29:        823299       26345568  com.alibaba.fastjson.util.IdentityHashMap$Entry
  30:        823200       19756800  sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl (java.base@11.0.2)
  31:        823186       19756464  sun.reflect.generics.scope.ClassScope (java.base@11.0.2)
  32:        823157       19755768  com.alibaba.fastjson.util.ParameterizedTypeImpl
  33:        823186       13171184  [Ljava.lang.reflect.TypeVariable; (java.base@11.0.2)
soat7uwm

soat7uwm1#

It seems like I have a similar problem, with up to 20 threads reading a large bag of JSON files simultaneously.

相关问题