From 8c60967c655e947b995276aadc6eaf85c46fee2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Tue, 25 Feb 2025 21:28:17 +0900 Subject: [PATCH] feat(pbuf): add api KeepAlive --- pbuf/bytes.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pbuf/bytes.go b/pbuf/bytes.go index fb3ad26..17235ab 100644 --- a/pbuf/bytes.go +++ b/pbuf/bytes.go @@ -2,6 +2,7 @@ package pbuf import ( "bytes" + "runtime" "github.com/fumiama/orbyte" ) @@ -122,4 +123,6 @@ func (b Bytes) Slice(from, to int) Bytes { func (b Bytes) KeepAlive() { _ = b.buf _ = b.dat + runtime.KeepAlive(b.buf) + runtime.KeepAlive(b.dat) }