Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ObjectLeakCheck ¶
type ObjectLeakCheck struct {
// contains filtered or unexported fields
}
ObjectLeakCheck tracks objects reachable from roots and reports objects that remain reachable after GC.
func NewObjectLeakCheck ¶
func NewObjectLeakCheck(opts ...Option) (ObjectLeakCheck, error)
NewObjectLeakCheck creates an object leak checker.
func (*ObjectLeakCheck) Check ¶
func (t *ObjectLeakCheck) Check() (string, error)
Check settles GC, then returns a full retained-object report and an error for retained objects not covered by expected patterns, expected patterns that no longer match any tracked object, or prune rules that did not match during tracking.
func (*ObjectLeakCheck) Track ¶
func (t *ObjectLeakCheck) Track(root any)
Track walks all values reachable from root and tracks pointer objects it finds.
type Option ¶
type Option func(*ObjectLeakCheck) error
func WithExpected ¶
WithExpected marks retained objects whose reflected path or type name matches pattern as expected. A trailing '*' matches any suffix.
func WithGCSettleTimeout ¶
WithGCSettleTimeout sets the maximum time Check spends forcing GC and waiting for retained-object counts to settle.
func WithPruneType ¶
WithPruneType prevents Track from descending into values whose reflected type matches pattern. Named types match their package-qualified name. A trailing '*' matches any suffix.