1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-12-31 22:45:39 -05:00

GetPool() API

This commit is contained in:
Darien Raymond
2018-09-03 20:57:40 +02:00
parent 1cf5225c0a
commit ff0b0b1640
2 changed files with 16 additions and 4 deletions

View File

@@ -172,9 +172,11 @@ func (b *Buffer) String() string {
return string(b.Bytes())
}
var pool = bytespool.GetPool(Size)
// New creates a Buffer with 0 length and 2K capacity.
func New() *Buffer {
return &Buffer{
v: bytespool.Alloc(Size),
v: pool.Get().([]byte),
}
}