Documentation
¶
Overview ¶
Package leakcheck fails a test binary that finishes with resources still held.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Leaked ¶
Leaked waits for every check to drain and returns the report of those that did not, or "" when all are clean.
func Main ¶
Main runs the tests of m and, when they all pass, fails the binary if any check still reports a leak after it had time to settle. It is meant for TestMain:
func TestMain(m *testing.M) { leakcheck.Main(m, leakcheck.Counter("owner pins", vectorized.OutstandingOwnerPins)) }
Set BYDB_LEAK_STACKS=1 to track where pooled objects were acquired.
Types ¶
type Check ¶
type Check func() string
Check returns a description of what is still held, or "" when nothing is.
func Pools ¶
Pools is a check that every pool whose name starts with one of prefixes has nothing checked out. A pool whose objects are also created outside it and then released into it counts below zero, so use it only for pools every object of which is taken from the pool. It passes trivially in slim builds.