diff --git a/cephfs/userperm.go b/cephfs/userperm.go index df214dea8..5adb8a5ff 100644 --- a/cephfs/userperm.go +++ b/cephfs/userperm.go @@ -8,7 +8,6 @@ package cephfs import "C" import ( - "runtime" "unsafe" "github.com/ceph/go-ceph/internal/log" @@ -49,11 +48,7 @@ func NewUserPerm(uid, gid int, gidlist []int) *UserPerm { } p.userPerm = C.ceph_userperm_new( p.uid, p.gid, C.int(len(p.gidList)), cgids) - // if the go object is unreachable, we would like to free the c-memory - // since this has no other resources than memory associated with it. - // This is only valid for UserPerm objects created by new, and thus have - // the managed var set. - runtime.SetFinalizer(p, destroyUserPerm) + return p } diff --git a/rados/conn.go b/rados/conn.go index b866a796b..c43b43e6d 100644 --- a/rados/conn.go +++ b/rados/conn.go @@ -71,9 +71,6 @@ func (c *Conn) Connect() error { // Shutdown disconnects from the cluster. func (c *Conn) Shutdown() { - if err := c.ensureConnected(); err != nil { - return - } freeConn(c) } diff --git a/rados/omap.go b/rados/omap.go index 525826ba1..3af0ec7b2 100644 --- a/rados/omap.go +++ b/rados/omap.go @@ -8,7 +8,6 @@ package rados import "C" import ( - "runtime" "unsafe" ) @@ -44,7 +43,7 @@ func newGetOmapStep() *GetOmapStep { more: (*C.uchar)(C.malloc(C.sizeof_uchar)), rval: (*C.int)(C.malloc(C.sizeof_int)), } - runtime.SetFinalizer(gos, opStepFinalizer) + return gos } diff --git a/rados/rados.go b/rados/rados.go index 98d77ca8a..0fe46bee4 100644 --- a/rados/rados.go +++ b/rados/rados.go @@ -7,7 +7,6 @@ package rados import "C" import ( - "runtime" "unsafe" "github.com/ceph/go-ceph/internal/log" @@ -74,7 +73,6 @@ func newConn(user *C.char) (*Conn, error) { return nil, getError(ret) } - runtime.SetFinalizer(conn, freeConn) return conn, nil } @@ -107,7 +105,6 @@ func NewConnWithClusterAndUser(clusterName string, userName string) (*Conn, erro return nil, getError(ret) } - runtime.SetFinalizer(conn, freeConn) return conn, nil }