Reloading fixed dictionary when clearing memory

This commit is contained in:
matlabbe
2018-07-12 10:06:02 -04:00
parent 281452434c
commit 4632c7650f
2 changed files with 7 additions and 1 deletions

View File

@@ -336,7 +336,7 @@ void Memory::loadDataFromDb(bool postInitClosingEvents)
}
if(postInitClosingEvents) UEventsManager::post(new RtabmapEventInit(uFormat("Adding word references, done! (%d)", _vwd->getTotalActiveReferences())));
if(_vwd->getUnusedWordsSize())
if(_vwd->getUnusedWordsSize() && _vwd->isIncremental())
{
UWARN("_vwd->getUnusedWordsSize() must be empty... size=%d", _vwd->getUnusedWordsSize());
}

View File

@@ -586,6 +586,12 @@ void VWDictionary::clear(bool printWarningsIfNotEmpty)
_unusedWords.clear();
_flannIndex->release();
useDistanceL1_ = false;
if(!_incrementalDictionary)
{
// reload the fixed dictionary
this->setFixedDictionary(_dictionaryPath);
}
}
int VWDictionary::getNextId()