diff --git a/dbg/pprof_cgo.go b/dbg/pprof_cgo.go index 28ddf5e..171c869 100644 --- a/dbg/pprof_cgo.go +++ b/dbg/pprof_cgo.go @@ -4,5 +4,5 @@ package dbg import ( - _ "github.com/benesch/cgosymbolizer" + _ "github.com/ianlancetaylor/cgosymbolizer" ) diff --git a/go.mod b/go.mod index 3b68f44..8ccd344 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,4 @@ module github.com/erigontech/mdbx-go go 1.15 -require ( - github.com/benesch/cgosymbolizer v0.0.0-20190515212042-bec6fe6e597b - github.com/ianlancetaylor/cgosymbolizer v0.0.0-20240503222823-736c933a666d // indirect -) +require github.com/ianlancetaylor/cgosymbolizer v0.0.0-20240503222823-736c933a666d diff --git a/go.sum b/go.sum index 76fb53b..1ee8b9a 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,2 @@ -github.com/benesch/cgosymbolizer v0.0.0-20190515212042-bec6fe6e597b h1:5JgaFtHFRnOPReItxvhMDXbvuBkjSWE+9glJyF466yw= -github.com/benesch/cgosymbolizer v0.0.0-20190515212042-bec6fe6e597b/go.mod h1:eMD2XUcPsHYbakFEocKrWZp47G0MRJYoC60qFblGjpA= github.com/ianlancetaylor/cgosymbolizer v0.0.0-20240503222823-736c933a666d h1:Azx2B59D4+zpVVtuYb8Oe3uOLi/ift4xfwKdhBX0Cy0= github.com/ianlancetaylor/cgosymbolizer v0.0.0-20240503222823-736c933a666d/go.mod h1:DvXTE/K/RtHehxU8/GtDs4vFtfw64jJ3PaCnFri8CRg= diff --git a/mdbx/cursor.go b/mdbx/cursor.go index 991e2e7..4f10779 100644 --- a/mdbx/cursor.go +++ b/mdbx/cursor.go @@ -158,7 +158,7 @@ func (c *Cursor) Get(setkey, setval []byte, op uint) (key, val []byte, err error err = c.getVal2(setkey, setval, op) } if err != nil { - *c.txn.key = C.MDBX_val{} + c.txn.key = C.MDBX_val{} c.txn.val = C.MDBX_val{} return nil, nil, err } @@ -171,14 +171,14 @@ func (c *Cursor) Get(setkey, setval []byte, op uint) (key, val []byte, err error key = setkey } else { if op != LastDup && op != FirstDup { - key = castToBytes(c.txn.key) + key = castToBytes(&c.txn.key) } } val = castToBytes(&c.txn.val) // Clear transaction storage record storage area for future use and to // prevent dangling references. - *c.txn.key = C.MDBX_val{} + c.txn.key = C.MDBX_val{} c.txn.val = C.MDBX_val{} return key, val, nil @@ -189,7 +189,7 @@ func (c *Cursor) Get(setkey, setval []byte, op uint) (key, val []byte, err error // // See mdb_cursor_get. func (c *Cursor) getVal0(op uint) error { - ret := C.mdbx_cursor_get(c._c, c.txn.key, &c.txn.val, C.MDBX_cursor_op(op)) + ret := C.mdbx_cursor_get(c._c, &c.txn.key, &c.txn.val, C.MDBX_cursor_op(op)) return operrno("mdbx_cursor_get", ret) } @@ -205,7 +205,7 @@ func (c *Cursor) getVal1(setkey []byte, op uint) error { ret := C.mdbxgo_cursor_get1( c._c, k, C.size_t(len(setkey)), - c.txn.key, + &c.txn.key, &c.txn.val, C.MDBX_cursor_op(op), ) @@ -219,7 +219,7 @@ func (c *Cursor) getVal01(setval []byte, op uint) error { ret := C.mdbxgo_cursor_get01( c._c, v, C.size_t(len(setval)), - c.txn.key, + &c.txn.key, &c.txn.val, C.MDBX_cursor_op(op), ) @@ -242,7 +242,7 @@ func (c *Cursor) getVal2(setkey, setval []byte, op uint) error { c._c, k, C.size_t(len(setkey)), v, C.size_t(len(setval)), - c.txn.key, &c.txn.val, + &c.txn.key, &c.txn.val, C.MDBX_cursor_op(op), ) return operrno("mdbx_cursor_get", ret) diff --git a/mdbx/txn.go b/mdbx/txn.go index 92b27b8..32832a4 100644 --- a/mdbx/txn.go +++ b/mdbx/txn.go @@ -59,7 +59,7 @@ const ( type Txn struct { env *Env _txn *C.MDBX_txn - key *C.MDBX_val + key C.MDBX_val val C.MDBX_val errLogf func(format string, v ...interface{}) @@ -92,13 +92,13 @@ func beginTxn(env *Env, parent *Txn, flags uint) (*Txn, error) { if flags&Readonly == 0 { // In a write Txn we can use the shared, C-allocated key and value // allocated by env, and freed when it is closed. - txn.key = env.ckey + txn.key = *env.ckey } else { // It is not easy to share C.MDBX_val values in this scenario unless // there is a synchronized pool involved, which will increase // overhead. Further, allocating these values with C will add // overhead both here and when the values are freed. - txn.key = new(C.MDBX_val) + txn.key = C.MDBX_val{} } } else { // Because parent Txn objects cannot be used while a sub-Txn is active