mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-20 04:09:04 +00:00
Both encoders acquire a pooled BufferRecycler via factory._getBufferRecycler() but never return it. Jackson 3 changed the default pool from a ThreadLocal to a per-factory ConcurrentDequePool that only refills on an explicit releaseToPool(), so the gap leaves the pool empty and every encode allocates a fresh recycler and buffers. Hold the recycler in a local and release it once the generator and byte builder are done: in encodeValue's finally, and in the streaming path's doAfterTerminate after generator.close() and byteBuilder.release(). releaseToPool() is idempotent, so sharing the recycler with the generator cannot double-release. Closes gh-37059 Signed-off-by: samlightfoot <samueldlightfoot@gmail.com>