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

[QUESTION] #841

Closed
xxcka opened this issue Oct 14, 2022 · 4 comments
Closed

[QUESTION] #841

xxcka opened this issue Oct 14, 2022 · 4 comments
Labels
bug Something isn't working fixed question Further information is requested
Milestone

Comments

@xxcka
Copy link

xxcka commented Oct 14, 2022

使用com.alibaba.fastjson2.JSON#writeTo(java.io.OutputStream, java.lang.Object, com.alibaba.fastjson2.JSONWriter.Feature...)序列化大对象(数组,200M)时会出现OutOfMemoryError,查看是因为MAX_ARRAY_SIZE限制为64M。请问为什么是限制64M呢,可以修改这个值吗?

@xxcka xxcka added the question Further information is requested label Oct 14, 2022
@wenshao wenshao added this to the 2.0.16 milestone Oct 14, 2022
@wenshao wenshao added the bug Something isn't working label Oct 14, 2022
@wenshao
Copy link
Member

wenshao commented Oct 15, 2022

https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/fastjson2/fastjson2/2.0.16-SNAPSHOT/
新增加一个JSONWriter.Feature.LargeObject,启用后就可以写大于512M的对象,请帮忙用2.0.16-SNAPSHOT帮忙验证,2.0.16版本预计在10月30日前发布

@wenshao wenshao added the fixed label Oct 15, 2022
@wenshao
Copy link
Member

wenshao commented Oct 15, 2022

限制64M是为了有一些循环引用的场景导致内存占用过大的保护措施

@xxcka
Copy link
Author

xxcka commented Oct 20, 2022

2.0.16-SNAPSHOT使用JSONWriter.Feature.LargeObject写大于200M的对象没问题。感谢!

@xxcka xxcka closed this as completed Oct 20, 2022
@wenshao
Copy link
Member

wenshao commented Oct 22, 2022

https://github.com/alibaba/fastjson2/releases/tag/2.0.16
问题已修复,请用2.0.16版本

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants