alibaba / alibaba/fastjson2

[BUG]在使用JSON.toJSONString序列化对象时出现OutOfMemoryError: Metaspace

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

Description

### 问题描述
在生产环境打印较多日志时使用JSON.toJSONString序列化对象时会出现OutOfMemoryError: Metaspace

### 环境信息
*请填写以下信息:*

- OS信息: [e.g.:CentOS 8.4.2105 4Core 3.10GHz 16 GB]
- JDK信息: [e.g.:Openjdk 1.8.0_312]
- 版本信息:[e.g.:Fastjson2 2.0.38]

### 重现步骤
调用JSON.toJSONString方法

#### 附加信息
企业微信截图_d86bd2f0-311e-4fef-8d7d-ca1355ed05b6

Contributor guide

Open the contributing guide

Research direction

Start at the JSON.toJSONString entry point and reproduce the reported OutOfMemoryError: Metaspace during heavy logging and object serialization. The issue names no source file or test and omits the JDK, Fastjson2 version, and concrete object, so collect those details first; done means a verified reproduction and a confirmed resolution without Metaspace exhaustion.

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
18/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.