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
fix: resolve memory leak with gradual buffer shrinking strategy
Implement sophisticated buffer management that only shrinks when buffer is more than half empty, and reduces to half size (not exact size) to provide wiggle room for incoming data.
This prevents both memory leaks from oversized buffers and performance issues from excessive reallocations in high-throughput scenarios.
- Only shrink when buffer utilization < 50%
- When shrinking, reduce to max(half current size, 2x remaining data)
- Gradual reduction allows large buffers to shrink progressively
- Falls back to cursor strategy when buffer utilization is reasonable
0 commit comments