mirror of
https://github.com/fumiama/orbyte.git
synced 2026-06-13 06:50:30 +08:00
feat(pbuf): add api KeepAlive
This commit is contained in:
@@ -2,6 +2,7 @@ package pbuf
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"runtime"
|
||||||
|
|
||||||
"github.com/fumiama/orbyte"
|
"github.com/fumiama/orbyte"
|
||||||
)
|
)
|
||||||
@@ -122,4 +123,6 @@ func (b Bytes) Slice(from, to int) Bytes {
|
|||||||
func (b Bytes) KeepAlive() {
|
func (b Bytes) KeepAlive() {
|
||||||
_ = b.buf
|
_ = b.buf
|
||||||
_ = b.dat
|
_ = b.dat
|
||||||
|
runtime.KeepAlive(b.buf)
|
||||||
|
runtime.KeepAlive(b.dat)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user