public void Cache() { Database.Dispose(); // open the DB with a cache that is not owned by LevelDB, then // close DB and then free the cache var options = new Options() { CacheSize = 64 }; Database = new LDB(DatabasePath, options); options = null; GC.Collect(); GC.WaitForPendingFinalizers(); Database.Set("key1", "value1"); Database.Dispose(); Database = null; GC.Collect(); GC.WaitForPendingFinalizers(); }