diff options
author | Filip Gawin <filip.gawin@zoho.com> | 2020-10-03 16:17:24 +0200 |
---|---|---|
committer | Filip Gawin <filip.gawin@zoho.com> | 2020-10-04 13:18:24 +0200 |
commit | 0ac2be00934ce3789d87ce4efb8b991f308de521 (patch) | |
tree | 1fc7eda4ae4552dcbe24931dcbd55a9c004177fc | |
parent | Merge pull request #736 from Krutonium/master (diff) | |
download | re3-0ac2be00934ce3789d87ce4efb8b991f308de521.tar re3-0ac2be00934ce3789d87ce4efb8b991f308de521.tar.gz re3-0ac2be00934ce3789d87ce4efb8b991f308de521.tar.bz2 re3-0ac2be00934ce3789d87ce4efb8b991f308de521.tar.lz re3-0ac2be00934ce3789d87ce4efb8b991f308de521.tar.xz re3-0ac2be00934ce3789d87ce4efb8b991f308de521.tar.zst re3-0ac2be00934ce3789d87ce4efb8b991f308de521.zip |
-rw-r--r-- | src/core/Streaming.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp index 507815fa..4e12ab6d 100644 --- a/src/core/Streaming.cpp +++ b/src/core/Streaming.cpp @@ -2436,12 +2436,17 @@ CStreaming::DeleteRwObjectsNotInFrustumInSectorList(CPtrList &list, size_t mem) void CStreaming::MakeSpaceFor(int32 size) { - // BUG: ms_memoryAvailable can be uninitialized - // the code still happens to work in that case because ms_memoryAvailable is unsigned - // but it's not nice.... - +#ifdef FIX_BUGS +#define MB (1024 * 1024) + if(ms_memoryAvailable == 0) { + extern size_t _dwMemAvailPhys; + ms_memoryAvailable = (_dwMemAvailPhys - 10 * MB) / 2; + if(ms_memoryAvailable < 50 * MB) ms_memoryAvailable = 50 * MB; + } +#undef MB +#endif while(ms_memoryUsed >= ms_memoryAvailable - size) - if(!RemoveLeastUsedModel()){ + if(!RemoveLeastUsedModel()) { DeleteRwObjectsBehindCamera(ms_memoryAvailable - size); return; } |