warrenfalk / rocksdb-sharp

.net bindings for the rocksdb by facebook
Other
206 stars 65 forks source link

Garbage collection and Comparator callbacks #47

Closed pablofrommars closed 5 years ago

pablofrommars commented 6 years ago

Hi,

I am experiencing some issues with the use of custom key comparators. An exception is thrown by rocksdb_write:

Managed Debugging Assistant 'CallbackOnCollectedDelegate' : 'A callback was made on a garbage collected delegate of type 'RocksDbSharp!RocksDbSharp.CompareFunc::Invoke'. This may cause application crashes, corruption and data loss. When passing delegates to unmanaged code, they must be kept alive by the managed application until it is guaranteed that they will never be called.'

To rule out any issue related to my implementation of Comparator, I have used the included StringComparator and the exception still remains. Is this to be expected?

Thanks to everyone involved with the project!

warrenfalk commented 5 years ago

The comparators have been redone in current master which should make this easier and also prevent garbage collection issues. This should be fixed when 5.17.2 is released soon.