// Worst-case estimates
const size_t MiB = (size_t)(1<<20);
const size_t baseMemUsage = 400*MiB;
+
+#if (DE_PTR_SIZE == 4)
+ // Some tests, such as:
+ //
+ // dEQP-VK.api.object_management.max_concurrent.*
+ // dEQP-VK.memory.allocation.random.*
+ //
+ // when run in succession, can lead to system memory fragmentation. It depends on the allocator, and on some 32-bit
+ // systems can lead to out of memory errors. As a workaround, we use a smaller amount of memory on 32-bit systems,
+ // as this typically avoids out of memory errors caused by fragmentation.
+ const double safeUsageRatio = 0.1;
+#else
const double safeUsageRatio = 0.25;
+#endif
limits.totalSystemMemory = de::max((size_t)(double(deInt64(m_totalSystemMemory)-deInt64(baseMemUsage)) * safeUsageRatio), 16*MiB);