1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-10-13 12:34:10 -04:00

allocate buffer on stack

This commit is contained in:
Darien Raymond
2018-11-15 21:32:27 +01:00
parent a5ed9e00ab
commit a20262ef20
5 changed files with 27 additions and 4 deletions

View File

@@ -199,3 +199,11 @@ func New() *Buffer {
v: pool.Get().([]byte),
}
}
// StackNew creates a new Buffer object on stack.
// This method is for buffers that is released in the same function.
func StackNew() Buffer {
return Buffer{
v: pool.Get().([]byte),
}
}