MCPcopy Create free account
hub / github.com/valyala/bytebufferpool / Get

Method Get

pool.go:48–56  ·  view source on GitHub ↗

Get returns new byte buffer with zero length. The byte buffer may be returned to the pool via Put after the use in order to minimize GC overhead.

()

Source from the content-addressed store, hash-verified

46// The byte buffer may be returned to the pool via Put after the use
47// in order to minimize GC overhead.
48func (p *Pool) Get() *ByteBuffer {
49 v := p.pool.Get()
50 if v != nil {
51 return v.(*ByteBuffer)
52 }
53 return &ByteBuffer{
54 B: make([]byte, 0, atomic.LoadUint64(&p.defaultSize)),
55 }
56}
57
58// Put returns byte buffer to the pool.
59//

Callers 2

ExampleByteBufferFunction · 0.80
GetFunction · 0.80

Calls

no outgoing calls

Tested by 1

ExampleByteBufferFunction · 0.64