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:
@@ -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),
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user