mirror of
https://github.com/ceph/go-ceph
synced 2025-01-27 00:23:15 +00:00
rados: free object list results after listing
This fixes a memory leak that becomes substantial across large pools. Signed-off-by: Nick Janus <github@nondesignated.com>
This commit is contained in:
parent
7607fd801b
commit
5bb75604fa
@ -332,7 +332,8 @@ func (ioctx *IOContext) ListObjects(listFn ObjectListFunc) error {
|
||||
defer C.rados_object_list_cursor_free(ioctx.ioctx, finish)
|
||||
|
||||
for {
|
||||
ret := C.rados_object_list(ioctx.ioctx, next, finish, pageResults, nil, filterLen, (*C.rados_object_list_item)(unsafe.Pointer(&results[0])), &next)
|
||||
res := (*C.rados_object_list_item)(unsafe.Pointer(&results[0]))
|
||||
ret := C.rados_object_list(ioctx.ioctx, next, finish, pageResults, nil, filterLen, res, &next)
|
||||
if ret < 0 {
|
||||
return getError(ret)
|
||||
}
|
||||
@ -342,6 +343,7 @@ func (ioctx *IOContext) ListObjects(listFn ObjectListFunc) error {
|
||||
item := results[i]
|
||||
listFn(C.GoStringN(item.oid, (C.int)(item.oid_length)))
|
||||
}
|
||||
C.rados_object_list_free(C.size_t(ret), res)
|
||||
|
||||
if C.rados_object_list_is_end(ioctx.ioctx, next) == listEndSentinel {
|
||||
return nil
|
||||
|
Loading…
Reference in New Issue
Block a user