1
0
mirror of https://github.com/fumiama/orbyte.git synced 2026-06-07 19:40:51 +08:00

feat: add i/o limit

This commit is contained in:
源文雨
2025-04-04 22:01:47 +09:00
parent 59e6e88dbb
commit ac9d26dfb9
2 changed files with 41 additions and 5 deletions

View File

@@ -67,7 +67,7 @@ func (bufpooler[USRDAT]) Parse(obj any, pooled UserBuffer[USRDAT]) UserBuffer[US
func (bufpooler[USRDAT]) Reset(item *UserBuffer[USRDAT]) {
// See https://golang.org/issue/23199
const maxSize = 1 << 16
if item.Cap() > maxSize { // drop large buffer
if item.Cap() >= maxSize { // drop large buffer
*item = UserBuffer[USRDAT]{}
return
}