Documentation
¶
Overview ¶
Package mem implements the memory utility such as memory pool.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Pool ¶
type Pool[T any] struct { // contains filtered or unexported fields }
Pool represents memory pool of T.
It is suitable for managing temporary objects that can be individually saved and retrieved (mem.Pool.Put and mem.Pool.Get). Unlike variables or pointer variables, mem.Pool is safe for use by multiple goroutines and no new memory will be allocated.
It is a wrapper of sync.Pool to support generics and easy to use. For the actual usage, see the example in the package documentation.
Click to show internal directories.
Click to hide internal directories.