mirror of https://gitee.com/bigwinds/arangodb
fixed some leaks
This commit is contained in:
parent
a31fe62c34
commit
4727c833c8
|
@ -876,7 +876,7 @@ int SkiplistIndex::remove(arangodb::Transaction*, TRI_doc_mptr_t const* doc,
|
||||||
}
|
}
|
||||||
|
|
||||||
int SkiplistIndex::unload() {
|
int SkiplistIndex::unload() {
|
||||||
_skiplistIndex->truncate();
|
_skiplistIndex->truncate(true);
|
||||||
return TRI_ERROR_NO_ERROR;
|
return TRI_ERROR_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,16 +56,6 @@ MMFilesCollection::MMFilesCollection(LogicalCollection* collection)
|
||||||
|
|
||||||
MMFilesCollection::~MMFilesCollection() {
|
MMFilesCollection::~MMFilesCollection() {
|
||||||
close();
|
close();
|
||||||
|
|
||||||
for (auto& it : _datafiles) {
|
|
||||||
delete it;
|
|
||||||
}
|
|
||||||
for (auto& it : _journals) {
|
|
||||||
delete it;
|
|
||||||
}
|
|
||||||
for (auto& it : _compactors) {
|
|
||||||
delete it;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TRI_voc_rid_t MMFilesCollection::revision() const {
|
TRI_voc_rid_t MMFilesCollection::revision() const {
|
||||||
|
@ -83,14 +73,23 @@ int64_t MMFilesCollection::initialCount() const {
|
||||||
int MMFilesCollection::close() {
|
int MMFilesCollection::close() {
|
||||||
// close compactor files
|
// close compactor files
|
||||||
closeDatafiles(_compactors);
|
closeDatafiles(_compactors);
|
||||||
|
for (auto& it : _compactors) {
|
||||||
|
delete it;
|
||||||
|
}
|
||||||
_compactors.clear();
|
_compactors.clear();
|
||||||
|
|
||||||
// close journal files
|
// close journal files
|
||||||
closeDatafiles(_journals);
|
closeDatafiles(_journals);
|
||||||
|
for (auto& it : _journals) {
|
||||||
|
delete it;
|
||||||
|
}
|
||||||
_journals.clear();
|
_journals.clear();
|
||||||
|
|
||||||
// close datafiles
|
// close datafiles
|
||||||
closeDatafiles(_datafiles);
|
closeDatafiles(_datafiles);
|
||||||
|
for (auto& it : _datafiles) {
|
||||||
|
delete it;
|
||||||
|
}
|
||||||
_datafiles.clear();
|
_datafiles.clear();
|
||||||
|
|
||||||
return TRI_ERROR_NO_ERROR;
|
return TRI_ERROR_NO_ERROR;
|
||||||
|
|
|
@ -1856,10 +1856,9 @@ int MMFilesEngine::openCollection(TRI_vocbase_t* vocbase, LogicalCollection* col
|
||||||
filename = newName;
|
filename = newName;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRI_datafile_t* datafile =
|
std::unique_ptr<TRI_datafile_t> df(TRI_OpenDatafile(filename, ignoreErrors));
|
||||||
TRI_OpenDatafile(filename, ignoreErrors);
|
|
||||||
|
|
||||||
if (datafile == nullptr) {
|
if (df == nullptr) {
|
||||||
LOG_TOPIC(ERR, Logger::DATAFILES) << "cannot open datafile '"
|
LOG_TOPIC(ERR, Logger::DATAFILES) << "cannot open datafile '"
|
||||||
<< filename
|
<< filename
|
||||||
<< "': " << TRI_last_error();
|
<< "': " << TRI_last_error();
|
||||||
|
@ -1868,7 +1867,8 @@ int MMFilesEngine::openCollection(TRI_vocbase_t* vocbase, LogicalCollection* col
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
all.emplace_back(datafile);
|
all.emplace_back(df.get());
|
||||||
|
TRI_datafile_t* datafile = df.release();
|
||||||
|
|
||||||
// check the document header
|
// check the document header
|
||||||
char const* ptr = datafile->_data;
|
char const* ptr = datafile->_data;
|
||||||
|
|
|
@ -1895,7 +1895,7 @@ int TRI_datafile_t::close() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_state == TRI_DF_STATE_CLOSED) {
|
if (_state == TRI_DF_STATE_CLOSED) {
|
||||||
LOG(WARN) << "closing an already closed datafile '" << getName() << "'";
|
LOG(TRACE) << "closing an already closed datafile '" << getName() << "'";
|
||||||
return TRI_ERROR_NO_ERROR;
|
return TRI_ERROR_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -172,10 +172,10 @@ class SkipList {
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
~SkipList() {
|
~SkipList() {
|
||||||
truncate();
|
truncate(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void truncate() {
|
void truncate(bool createStartNode) {
|
||||||
Node* p;
|
Node* p;
|
||||||
Node* next;
|
Node* next;
|
||||||
|
|
||||||
|
@ -193,9 +193,12 @@ class SkipList {
|
||||||
|
|
||||||
_memoryUsed = sizeof(SkipList);
|
_memoryUsed = sizeof(SkipList);
|
||||||
_nrUsed = 0;
|
_nrUsed = 0;
|
||||||
_start = allocNode(TRI_SKIPLIST_MAX_HEIGHT);
|
|
||||||
// Note that this can throw
|
if (createStartNode) {
|
||||||
_end = _start;
|
_start = allocNode(TRI_SKIPLIST_MAX_HEIGHT);
|
||||||
|
// Note that this can throw
|
||||||
|
_end = _start;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
Loading…
Reference in New Issue