diff options
-rw-r--r-- | include/rocksdb/utilities/transaction_db.h | 5 | ||||
-rw-r--r-- | include/rocksdb/write_batch.h | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/include/rocksdb/utilities/transaction_db.h b/include/rocksdb/utilities/transaction_db.h index 702266640..78ff0816f 100644 --- a/include/rocksdb/utilities/transaction_db.h +++ b/include/rocksdb/utilities/transaction_db.h @@ -460,7 +460,10 @@ class TransactionDB : public StackableDB { // // If old_txn is not null, BeginTransaction will reuse this Transaction // handle instead of allocating a new one. This is an optimization to avoid - // extra allocations when repeatedly creating transactions. + // extra allocations when repeatedly creating transactions. **Note that this + // may not free all the allocated memory by the previous transaction (see + // WriteBatch::Clear()). To ensure that all allocated memory is freed, users + // must destruct the transaction object. virtual Transaction* BeginTransaction( const WriteOptions& write_options, const TransactionOptions& txn_options = TransactionOptions(), diff --git a/include/rocksdb/write_batch.h b/include/rocksdb/write_batch.h index df7048af3..7cdca233a 100644 --- a/include/rocksdb/write_batch.h +++ b/include/rocksdb/write_batch.h @@ -209,6 +209,8 @@ class WriteBatch : public WriteBatchBase { using WriteBatchBase::Clear; // Clear all updates buffered in this batch. + // Internally, it calls resize() on the string buffer. So allocated memory + // capacity may not be freed. void Clear() override; // Records the state of the batch for future calls to RollbackToSavePoint(). |