[RocksJava] DefaultColumnFamily Memory Fix
In the current implementation DefaultColumnFamily will not disown the native handle. As the database handles the lease on the native handle this should be the case.
This commit is contained in:
parent
22c73d15b2
commit
a01b592597
@ -1270,7 +1270,10 @@ public class RocksDB extends RocksObject {
|
||||
* @return The handle of the default column family
|
||||
*/
|
||||
public ColumnFamilyHandle getDefaultColumnFamily() {
|
||||
return new ColumnFamilyHandle(this, getDefaultColumnFamily(nativeHandle_));
|
||||
ColumnFamilyHandle cfHandle = new ColumnFamilyHandle(this,
|
||||
getDefaultColumnFamily(nativeHandle_));
|
||||
cfHandle.disOwnNativeHandle();
|
||||
return cfHandle;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -58,11 +58,7 @@ public class ColumnFamilyTest {
|
||||
Options options = null;
|
||||
ColumnFamilyHandle cfh = null;
|
||||
try {
|
||||
options = new Options();
|
||||
options.setCreateIfMissing(true);
|
||||
|
||||
DBOptions dbOptions = new DBOptions();
|
||||
dbOptions.setCreateIfMissing(true);
|
||||
options = new Options().setCreateIfMissing(true);
|
||||
|
||||
db = RocksDB.open(options, dbFolder.getRoot().getAbsolutePath());
|
||||
cfh = db.getDefaultColumnFamily();
|
||||
@ -78,9 +74,6 @@ public class ColumnFamilyTest {
|
||||
assertThat(cfh).isNotNull();
|
||||
assertThat(actualValue).isEqualTo(value);
|
||||
} finally {
|
||||
if (cfh != null) {
|
||||
cfh.dispose();
|
||||
}
|
||||
if (db != null) {
|
||||
db.close();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user