mirror of https://gitee.com/bigwinds/arangodb
fix memleaks
This commit is contained in:
parent
2b594bdab5
commit
ed1e0336cb
|
@ -33,6 +33,24 @@ using namespace arangodb::rocksutils;
|
|||
|
||||
const char RocksDBKey::_stringSeparator = '\0';
|
||||
|
||||
RocksDBKey::RocksDBKey(std::string* leased)
|
||||
: _type(RocksDBEntryType::Document), // placeholder
|
||||
_local(),
|
||||
_buffer(leased != nullptr ? leased : &_local) {}
|
||||
|
||||
RocksDBKey::RocksDBKey(rocksdb::Slice slice)
|
||||
: _type(static_cast<RocksDBEntryType>(slice.data()[0])),
|
||||
_local(slice.data(), slice.size()),
|
||||
_buffer(&_local) {}
|
||||
|
||||
RocksDBKey::RocksDBKey(RocksDBKey&& other) noexcept
|
||||
: _type(other._type),
|
||||
_local(),
|
||||
_buffer(&_local) {
|
||||
_local.assign(std::move(*(other._buffer)));
|
||||
other._buffer = &(other._local);
|
||||
}
|
||||
|
||||
/// @brief verify that a key actually contains the given local document id
|
||||
bool RocksDBKey::containsLocalDocumentId(LocalDocumentId const& documentId) const {
|
||||
switch (_type) {
|
||||
|
|
|
@ -47,23 +47,11 @@ class RocksDBKey {
|
|||
|
||||
/// @brief construct a leased RocksDBKey
|
||||
/// @param leased will use _local std::string if nullptr
|
||||
explicit RocksDBKey(std::string* leased)
|
||||
: _type(RocksDBEntryType::Document), // placeholder
|
||||
_local(),
|
||||
_buffer(leased != nullptr ? leased : &_local) {}
|
||||
explicit RocksDBKey(std::string* leased);
|
||||
|
||||
explicit RocksDBKey(rocksdb::Slice slice)
|
||||
: _type(static_cast<RocksDBEntryType>(slice.data()[0])),
|
||||
_local(slice.data(), slice.size()),
|
||||
_buffer(&_local) {}
|
||||
explicit RocksDBKey(rocksdb::Slice slice);
|
||||
|
||||
RocksDBKey(RocksDBKey&& other) noexcept
|
||||
: _type(other._type),
|
||||
_local(),
|
||||
_buffer(&_local) {
|
||||
_local.assign(std::move(*(other._buffer)));
|
||||
other._buffer = &(other._local);
|
||||
}
|
||||
RocksDBKey(RocksDBKey&& other) noexcept;
|
||||
|
||||
RocksDBKey& operator=(RocksDBKey const& other) = delete;
|
||||
RocksDBKey& operator=(RocksDBKey&& other) = delete;
|
||||
|
|
|
@ -98,11 +98,14 @@ transaction::Context::~Context() {
|
|||
delete it;
|
||||
}
|
||||
|
||||
// clear all strings handed out
|
||||
for (auto& it : _strings) {
|
||||
delete it;
|
||||
}
|
||||
|
||||
if (_ownsResolver) {
|
||||
delete _resolver;
|
||||
}
|
||||
|
||||
_resolver = nullptr;
|
||||
}
|
||||
|
||||
/// @brief factory to create a custom type handler, not managed
|
||||
|
|
Loading…
Reference in New Issue