summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilip Gawin <filip.gawin@zoho.com>2020-10-03 16:17:24 +0200
committereray orçunus <erayorcunus@gmail.com>2020-10-08 17:45:07 +0200
commit6bae5a6031da84caa6ac6dbc9d0bfbafe4d93eb0 (patch)
tree7e6cb4cf3311552f765453020c8b4a6cdfdafdc6
parentFix some sanitizer errors, improve POSIX streamer (diff)
downloadre3-6bae5a6031da84caa6ac6dbc9d0bfbafe4d93eb0.tar
re3-6bae5a6031da84caa6ac6dbc9d0bfbafe4d93eb0.tar.gz
re3-6bae5a6031da84caa6ac6dbc9d0bfbafe4d93eb0.tar.bz2
re3-6bae5a6031da84caa6ac6dbc9d0bfbafe4d93eb0.tar.lz
re3-6bae5a6031da84caa6ac6dbc9d0bfbafe4d93eb0.tar.xz
re3-6bae5a6031da84caa6ac6dbc9d0bfbafe4d93eb0.tar.zst
re3-6bae5a6031da84caa6ac6dbc9d0bfbafe4d93eb0.zip
-rw-r--r--src/core/Streaming.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp
index 1651f5b3..ddde4664 100644
--- a/src/core/Streaming.cpp
+++ b/src/core/Streaming.cpp
@@ -2936,10 +2936,15 @@ 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 < 65 * MB) ms_memoryAvailable = 65 * MB;
+ }
+#undef MB
+#endif
while(ms_memoryUsed >= ms_memoryAvailable - size)
if(!RemoveLeastUsedModel(STREAMFLAGS_20)){
DeleteRwObjectsBehindCamera(ms_memoryAvailable - size);