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