Merge pull request #3067 from akortunov/master

Limit pointers cache size to avoid possible bad_alloc errors
pull/593/head
Andrei Kortunov 4 years ago committed by GitHub
commit 57b501ad13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -134,7 +134,7 @@ MWWorld::Cells::Cells (const MWWorld::ESMStore& store, std::vector<ESM::ESMReade
: mStore (store), mReader (reader),
mIdCacheIndex (0)
{
int cacheSize = std::max(Settings::Manager::getInt("pointers cache size", "Cells"), 0);
int cacheSize = std::clamp(Settings::Manager::getInt("pointers cache size", "Cells"), 40, 1000);
mIdCache = IdCache(cacheSize, std::pair<std::string, CellStore *> ("", (CellStore*)nullptr));
}

@ -175,7 +175,7 @@ pointers cache size
-------------------
:Type: integer
:Range: >0
:Range: 40 to 1000
:Default: 40
The count of object pointers that will be saved for a faster search by object ID.

Loading…
Cancel
Save