mirror of
https://github.com/apple/swift-nio
synced 2026-11-29 05:24:21 +00:00
Motivation: ByteToMessageDecoder implementations can potentially have usage patterns that never reclaim memory. This is problematic when used for a long time, as they can be holding on to large chunks of memory they don't need. Modifications: Gave ByteToMessageDecoder a new protocol method, shouldReclaimBytes(buffer:), and a default implementation. Result: ByteToMessageDecoders will not be able to hold on to more than 2kB of unreachable memory under any circumstances, and will often hold less memory than that.