fix memory leak (iterator never finished so cleanup didn't run)
This commit is contained in:
parent
f9011c7d52
commit
ca840aea7f
2 changed files with 2 additions and 3 deletions
1
db/db.go
1
db/db.go
|
@ -335,6 +335,7 @@ func IterCF(db *grocksdb.DB, opts *IterOptions) <-chan *prefixes.PrefixRowKV {
|
||||||
defer func() {
|
defer func() {
|
||||||
it.Close()
|
it.Close()
|
||||||
close(ch)
|
close(ch)
|
||||||
|
ro.Destroy()
|
||||||
}()
|
}()
|
||||||
|
|
||||||
var prevKey []byte
|
var prevKey []byte
|
||||||
|
|
|
@ -164,7 +164,7 @@ func (db *ReadOnlyDBColumnFamily) GetShortClaimIdUrl(name string, normalizedName
|
||||||
// Prefix and handle
|
// Prefix and handle
|
||||||
options := NewIterateOptions().WithPrefix(prefix).WithCfHandle(handle)
|
options := NewIterateOptions().WithPrefix(prefix).WithCfHandle(handle)
|
||||||
// Start and stop bounds
|
// Start and stop bounds
|
||||||
options = options.WithStart(keyPrefix)
|
options = options.WithStart(keyPrefix).WithStop(keyPrefix)
|
||||||
// Don't include the key
|
// Don't include the key
|
||||||
options = options.WithIncludeValue(false)
|
options = options.WithIncludeValue(false)
|
||||||
|
|
||||||
|
@ -428,8 +428,6 @@ func (db *ReadOnlyDBColumnFamily) GetControllingClaim(name string) (*prefixes.Cl
|
||||||
log.Println(hex.EncodeToString(rawKey))
|
log.Println(hex.EncodeToString(rawKey))
|
||||||
slice, err := db.DB.GetCF(db.Opts, handle, rawKey)
|
slice, err := db.DB.GetCF(db.Opts, handle, rawKey)
|
||||||
defer slice.Free()
|
defer slice.Free()
|
||||||
log.Printf("slice: %#v", slice)
|
|
||||||
log.Printf("err: %#v", err)
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
Loading…
Add table
Reference in a new issue