From 31c44bc478f96b14dcd31ee6d40345f937aabd5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Tue, 7 Apr 2026 20:34:55 +0800 Subject: [PATCH] Fix buffer not released in batchLoopDarwin --- stack_mixed.go | 2 ++ stack_system.go | 2 ++ 2 files changed, 4 insertions(+) diff --git a/stack_mixed.go b/stack_mixed.go index 6518cd0..8836d6b 100644 --- a/stack_mixed.go +++ b/stack_mixed.go @@ -184,6 +184,7 @@ func (m *Mixed) batchLoopDarwin(darwinTUN DarwinTUN) { for _, buffer := range buffers { packetSize := buffer.Len() if packetSize < header.IPv4MinimumSize { + buffer.Release() continue } if m.processPacket(buffer.Bytes()) { @@ -197,6 +198,7 @@ func (m *Mixed) batchLoopDarwin(darwinTUN DarwinTUN) { if err != nil { m.logger.Trace(E.Cause(err, "batch write packet")) } + buf.ReleaseMulti(writeBuffers) } } } diff --git a/stack_system.go b/stack_system.go index e2cdd45..ef8b709 100644 --- a/stack_system.go +++ b/stack_system.go @@ -281,6 +281,7 @@ func (s *System) batchLoopDarwin(darwinTUN DarwinTUN) { for _, buffer := range buffers { packetSize := buffer.Len() if packetSize < header.IPv4MinimumSize { + buffer.Release() continue } if s.processPacket(buffer.Bytes()) { @@ -294,6 +295,7 @@ func (s *System) batchLoopDarwin(darwinTUN DarwinTUN) { if err != nil { s.logger.Trace(E.Cause(err, "batch write packet")) } + buf.ReleaseMulti(writeBuffers) } } }