mirror of
https://github.com/go-gst/go-gst.git
synced 2025-10-03 15:16:27 +08:00

this example has an assert that checks wether or nor the finalizers ran correctly. If they don't then a mem leak will happen
12 lines
242 B
Go
12 lines
242 B
Go
package common
|
|
|
|
import "fmt"
|
|
|
|
var FinalizersCalled int = 0
|
|
|
|
func AssertFinalizersCalled(x int) {
|
|
if FinalizersCalled != x {
|
|
panic(fmt.Sprintf("finalizers did not run correctly, memory leak, wanted: %d, got: %d", x, FinalizersCalled))
|
|
}
|
|
}
|