1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-08 09:37:53 +00:00

Limit pointers cache size to avoid possible bad_alloc errors

This commit is contained in:
Andrei Kortunov 2021-04-16 08:10:31 +04:00
parent af8bc7d120
commit 5de72c94ab
2 changed files with 2 additions and 2 deletions

View File

@ -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));
}

View File

@ -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.