private static String createTestStr() {
        String tmp = new String(IOUtils.DIGITS);
        StringBuilder builder = new StringBuilder();
        for (int i = 0; i < 400; i++) {
            builder.append(tmp);
        }
        return builder.toString();
    }
Execute toBytes periodically, use tools to analyze JVM memory allocation.
For example, Memory Allocation Record of YourKit java profiler
src/test/java/com/alibaba/fastjson/serializer/SerializeWriterToBytesTest.java