MCPcopy
hub / github.com/Terry-Mao/goim / Get

Method Get

pkg/bytes/buffer.go:69–78  ·  view source on GitHub ↗

Get get a free memory buffer.

()

Source from the content-addressed store, hash-verified

67
68// Get get a free memory buffer.
69func (p *Pool) Get() (b *Buffer) {
70 p.lock.Lock()
71 if b = p.free; b == nil {
72 p.grow()
73 b = p.free
74 }
75 p.free = b.next
76 p.lock.Unlock()
77 return
78}
79
80// Put put back a memory buffer to free.
81func (p *Pool) Put(b *Buffer) {

Callers 5

TestBufferFunction · 0.95
JoinInt32sFunction · 0.45
JoinInt64sFunction · 0.45
UpgradeFunction · 0.45
ReadRequestFunction · 0.45

Calls 1

growMethod · 0.95

Tested by 1

TestBufferFunction · 0.76