Documentation
¶
Overview ¶
Package pool provides a pool for reusing objects.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllRefsCount ¶
AllRefsCount returns the reference count of all pools.
func AllStacks ¶ added in v0.9.0
AllStacks returns all recorded stack traces for leaked objects from all pools.
func EnableStackTracking ¶ added in v0.9.0
func EnableStackTracking(enabled bool)
EnableStackTracking enables or disables stack tracking for all pools.
Types ¶
type StackTracker ¶ added in v0.9.0
type StackTracker interface {
// Stacks returns all recorded stack traces for objects in the pool.
Stacks() []string
}
StackTracker is the interface that wraps the Stacks method.
type Synced ¶
Synced is a pool that is safe for concurrent use.
func (*Synced[T]) Get ¶
func (p *Synced[T]) Get() T
Get returns an object from the pool. If the pool is empty, nil is returned.
Click to show internal directories.
Click to hide internal directories.