diff --git a/Makefile b/Makefile index 08d6427..b7d5e6d 100644 --- a/Makefile +++ b/Makefile @@ -129,6 +129,9 @@ mem: clean go test -run @ -bench . -memprofile mem.out -memprofilerate 1 -timeout 24h go tool pprof -lines -web -alloc_space *.test mem.out +memgrind: + go test -v -timeout 24h -tags=libc.memgrind,cgobench -run Test[^T][^c][^l] -bench . -recs_per_sec_as_mbps 2>&1 | tee log-memgrind + nuke: clean go clean -i diff --git a/all_test.go b/all_test.go index 5ac0954..b451533 100644 --- a/all_test.go +++ b/all_test.go @@ -867,9 +867,6 @@ func TestNoRows(t *testing.T) { defer func() { os.RemoveAll(tempDir) - if err := libc.MemAuditReport(); err != nil { - t.Error(err) - } }() db, err := sql.Open("sqlite", filepath.Join(tempDir, "foo.db")) @@ -877,13 +874,20 @@ func TestNoRows(t *testing.T) { t.Fatalf("foo.db open fail: %v", err) } - defer db.Close() + defer func() { + db.Close() + if err := libc.MemAuditReport(); err != nil { + t.Error(err) + } + }() stmt, err := db.Prepare("create table t(i);") if err != nil { t.Fatal(err) } + defer stmt.Close() + if _, err := stmt.Query(); err != nil { t.Fatal(err) } diff --git a/cgo_test.go b/cgo_test.go index 75f6c32..6b5f7c2 100644 --- a/cgo_test.go +++ b/cgo_test.go @@ -13,8 +13,8 @@ import ( "path/filepath" "testing" - "modernc.org/libc" _ "github.com/mattn/go-sqlite3" + "modernc.org/libc" ) const gcoDriver = "sqlite3" diff --git a/go.mod b/go.mod index e57ca61..e1f3e2d 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.15 require ( github.com/mattn/go-sqlite3 v1.14.6 - modernc.org/libc v0.0.0-20210116154030-fac1e8a80fa8 + modernc.org/libc v0.0.0-20210117101922-e473cf1fa08d modernc.org/mathutil v1.2.1 - modernc.org/tcl v0.0.0-20210116154350-d39acab84afa + modernc.org/tcl v0.0.0-20210117103524-d49b7700cb04 ) diff --git a/go.sum b/go.sum index 711db10..6a07baa 100644 --- a/go.sum +++ b/go.sum @@ -9,13 +9,13 @@ golang.org/x/sys v0.0.0-20201126233918-771906719818 h1:f1CIuDlJhwANEC2MM87MBEVMr golang.org/x/sys v0.0.0-20201126233918-771906719818/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= modernc.org/httpfs v1.0.2 h1:4aw8F68gTwx7FWL/vEMjm/XaPwPL16MItkF/P9ziEPY= modernc.org/httpfs v1.0.2/go.mod h1:7dosgurJGp0sPaRanU53W4xZYKh14wfzX420oZADeHM= -modernc.org/libc v0.0.0-20210116154030-fac1e8a80fa8 h1:VgMrmNSL/v8CFhC5H3IYpXqh/rG/vE9XJP6oFcMH2Y8= -modernc.org/libc v0.0.0-20210116154030-fac1e8a80fa8/go.mod h1:IR66laG5b3bONN1tfix3Gpy8xk/6WDf+Rtc4NqNczls= +modernc.org/libc v0.0.0-20210117101922-e473cf1fa08d h1:7HfGNf/4kVGhD0892iApRBzfgBCoiU27uNfBXSC1IuI= +modernc.org/libc v0.0.0-20210117101922-e473cf1fa08d/go.mod h1:IR66laG5b3bONN1tfix3Gpy8xk/6WDf+Rtc4NqNczls= modernc.org/mathutil v1.1.1 h1:FeylZSVX8S+58VsyJlkEj2bcpdytmp9MmDKZkKx8OIE= modernc.org/mathutil v1.1.1/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= modernc.org/mathutil v1.2.1 h1:PSIN4RdyeB6MbFsNLSkFCzDjnEVEMS3H/hFHcJtAJ9g= modernc.org/mathutil v1.2.1/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= modernc.org/memory v1.0.1 h1:bhVo78NAdgvRD4N+b2hGnAwL5RP2+QyiEJDsX3jpeDA= modernc.org/memory v1.0.1/go.mod h1:NSjvC08+g3MLOpcAxQbdctcThAEX4YlJ20WWHYEhvRg= -modernc.org/tcl v0.0.0-20210116154350-d39acab84afa h1:ilAz/AYRgGYZegGa9Ejqs+zjGwr1t7QxI06IReiw1OM= -modernc.org/tcl v0.0.0-20210116154350-d39acab84afa/go.mod h1:xEeGkvTg7q54vNvl7HiEDNtl3jeV1x7A5pGttMkAKkc= +modernc.org/tcl v0.0.0-20210117103524-d49b7700cb04 h1:1LbJn1bufrrSeXeoGoxv184/gqoSFN/Xg7wYtkY546Y= +modernc.org/tcl v0.0.0-20210117103524-d49b7700cb04/go.mod h1:LHPUvds6xQj57HUtr4DiAbRZTVRidnxy6uQEtG48gaE=