MCPcopy Create free account
hub / github.com/djherbis/buffer / NewMemPool

Function NewMemPool

pool.go:54–61  ·  view source on GitHub ↗

NewMemPool returns a Pool, Get() returns an in memory buffer of max size N. Put() returns the buffer to the pool after resetting it. Get() and Put() errors will always be nil.

(N int64)

Source from the content-addressed store, hash-verified

52// Put() returns the buffer to the pool after resetting it.
53// Get() and Put() errors will always be nil.
54func NewMemPool(N int64) Pool {
55 return &memPool{
56 N: N,
57 Pool: NewPool(func() Buffer {
58 return New(N)
59 }),
60 }
61}
62
63func (m *memPool) MarshalBinary() ([]byte, error) {
64 buf := bytes.NewBuffer(nil)

Callers 1

TestMemPoolFunction · 0.85

Calls 2

NewPoolFunction · 0.85
NewFunction · 0.85

Tested by 1

TestMemPoolFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…