You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now, the driver uses pooled (attached) buffers when decoding Json. When not consuming the Json content, this may lead to a memory leak as the buffer backing the Json value is reference-counted and not disposed automatically.
This behavior is memory-efficient but it's not obvious. We should default to copy buffers into a data structure that can be garbage-collected. With copying data, we lose a bit of efficiency but provide memory-safety in return.
Original issue: spring-projects/spring-data-r2dbc/#453.
The text was updated successfully, but these errors were encountered:
JsonCodec now copies the decoded value from an attached buffer to a detached one reduce the risk of memory leaks. Detached buffers get garbage collected regardless of whether the decoded value gets consumed.
Attached buffers are reference-counted and don't get automatically garbage-collected which requires decoded values to be consumed. If a value backed by an attached buffer doesn't get consumed, then the memory backing the data structure isn't reclaimed and creates a memory leak. Since this behavior is non-obvious, we default to the less-efficient approach to copy buffers which prevents the risk of memory leaks.
[resolves#330]
Right now, the driver uses pooled (attached) buffers when decoding
Json
. When not consuming theJson
content, this may lead to a memory leak as the buffer backing theJson
value is reference-counted and not disposed automatically.This behavior is memory-efficient but it's not obvious. We should default to copy buffers into a data structure that can be garbage-collected. With copying data, we lose a bit of efficiency but provide memory-safety in return.
Original issue: spring-projects/spring-data-r2dbc/#453.
The text was updated successfully, but these errors were encountered: