Skip to content

Commit

Permalink
Free memory on writebatch index and avoid unnecessary clones
Browse files Browse the repository at this point in the history
  • Loading branch information
jkurian committed May 29, 2023
1 parent b539412 commit 14fecf0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/transactions/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -852,8 +852,8 @@ impl<'db, DB> Transaction<'db, DB> {
let wi = ffi::rocksdb_transaction_get_writebatch_wi(self.inner);
let mut len: usize = 0;
let ptr = ffi::rocksdb_writebatch_wi_data(wi, &mut len as _);
let data = std::slice::from_raw_parts(ptr, len).to_owned();
let writebatch = ffi::rocksdb_writebatch_create_from(data.as_ptr(), data.len());
let writebatch = ffi::rocksdb_writebatch_create_from(ptr, len);
ffi::rocksdb_free(wi as *mut c_void);
WriteBatchWithTransaction { inner: writebatch }
}
}
Expand Down

0 comments on commit 14fecf0

Please sign in to comment.