cuckoo: fix data race in marshal
@@ -24,6 +24,7 @@ import (
"fmt"
"math/rand"
"reflect"
+ "runtime"
"unsafe"
)
@@ -67,6 +68,8 @@ func (f *Filter) MarshalBinary() []byte {
sh.Len = NumBuckets * BucketSize
sh.Cap = NumBuckets * BucketSize
+ runtime.KeepAlive(f.Buckets)
+
return buf
}
