alibaba / fastjson2

🚄 FASTJSON2 is a Java JSON library with excellent performance.
Apache License 2.0
3.8k stars 496 forks source link

[QUESTION] java.lang.OutOfMemoryError: try enabling LargeObject feature instead #2628

Open 156370005 opened 5 months ago

156370005 commented 5 months ago

请问下,什么情况下会报这个错误: Caused by: java.lang.OutOfMemoryError: try enabling LargeObject feature instead at com.alibaba.fastjson2.JSONWriterUTF8.ensureCapacity(JSONWriterUTF8.java:2122) ~[fastjson2-2.0.50.jar:?] at com.alibaba.fastjson2.JSONWriterUTF8.writeStringUTF16(JSONWriterUTF8.java:570) ~[fastjson2-2.0.50.jar:?] at com.alibaba.fastjson2.writer.OWG_14_27_BaseCar.write(Unknown Source) ~[?:?] at com.alibaba.fastjson2.writer.ObjectWriterImplList.write(ObjectWriterImplList.java:364) ~[fastjson2-2.0.50.jar:?] at com.alibaba.fastjson2.writer.ObjectWriterArray.write(ObjectWriterArray.java:103) ~[fastjson2-2.0.50.jar:?] at com.alibaba.fastjson2.writer.OWG_3_3_Result.write(Unknown Source) ~[?:?] at com.alibaba.fastjson2.JSON.writeTo(JSON.java:3481) ~[fastjson2-2.0.50.jar:?] at com.alibaba.fastjson2.support.spring.http.converter.FastJsonHttpMessageConverter.writeInternal(FastJsonHttpMessageConverter.java:138) ~[fastjson2-extension-spring5-2.0.50.jar:?] at org.springframework.http.converter.AbstractHttpMessageConverter.write(AbstractHttpMessageConverter.java:227) ~[spring-web-5.3.19.jar:5.3.19] at com.alibaba.fastjson2.support.spring.http.converter.FastJsonHttpMessageConverter.write(FastJsonHttpMessageConverter.java:86) ~[fastjson2-extension-spring5-2.0.50.jar:?]

在fastjson1时,不报错的,谢谢!

yanxutao89 commented 5 months ago

按照提示开启LargeObject

chensanjiu commented 1 month ago

按照提示开启LargeObject

大佬,springBoot使用FastJsonHttpMessageConverter处理响应,FastJsonHttpMessageConverter没有地方设置LargeObject,导致接口返回数据时超过64M就报错了