sofastack / sofa-bolt

SOFABolt is a lightweight, easy to use and high performance remoting framework based on Netty.
https://www.sofastack.tech/projects/sofa-bolt/
Apache License 2.0
2.44k stars 860 forks source link

Hessian serializer memory optimization #302

Closed chuailiwu closed 2 years ago

chuailiwu commented 2 years ago

describe Hessian serialize() method uses toByteArray will copy a new byte array every time.

memory optimization use ThreadLocal variable will reuse the memory for every thread,it will reduce memory allocation once for per serialize