alibaba / alibaba/fastjson2

[QUESTION] 当频繁动态编译时会出现内存泄漏问题

Open
#3,651 6 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
Java
Stars
4.4k
Forks
613
Avg merge
1d 22h
Merged PRs (30d)
6

Description

通过自定义provider和context、reader可以确保其随着GC的消失而消失,其ObjecetReaderCreator在执行时会调用BeanUtils,context和provider已经提供了缓存的能力,在BeanUtils中进行缓存是否没有必要?
虽然提供了cleanUp方法,但是由于并发线程过多,我更希望其随着GC的生命周期消失而消失,目前前面的对象都可以做到,而BeanUtils中缓存的Class对象却无法随着GC消失而消失,存在内存泄漏的问题
希望BeanUtils可以实例化交给前置对象缓存,其内存管理随着jvm GC的消失而消失,不需要强制手动cleanUP才能解决内存泄漏的问题

Contributor guide

Open the contributing guide

Research direction

Start by tracing ObjectReaderCreator's BeanUtils usage during frequent dynamic compilation, then compare the existing cleanup path with the custom provider, context, and reader lifecycles described in the issue. Investigate how cached Class objects are retained and verify that they can be released with the surrounding objects rather than requiring manual cleanup; no specific files or tests are named.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.