Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

Linux: frameserver memory fix

Campbell Barton1db1c004b9ce
diff --git a/toonz/sources/toonzfarm/tfarmserver/tfarmserver.cpp b/toonz/sources/toonzfarm/tfarmserver/tfarmserver.cpp
index abbaedacb..6b4beb283 100644
--- a/toonz/sources/toonzfarm/tfarmserver/tfarmserver.cpp
+++ b/toonz/sources/toonzfarm/tfarmserver/tfarmserver.cpp
@@ -49,6 +49,10 @@ using namespace std;
#include <sys/sysctl.h> //To retrieve MAC HW infos
#endif
+#ifdef LINUX
+#include <sys/sysctl.h> //For getting total memory
+#endif
+
// forward declaration
class FarmServer;
@@ -693,8 +697,10 @@ void FarmServer::queryHwInfo(HwInfo &hwInfo)
hwInfo.m_type = Irix;
#else
- int mib[2];
TINT64 physMemSize;
+
+#ifdef MACOSX
+ int mib[2];
size_t len;
mib[0] = CTL_HW;
@@ -702,6 +708,14 @@ void FarmServer::queryHwInfo(HwInfo &hwInfo)
len = sizeof(physMemSize);
sysctl(mib, 2, &physMemSize, &len, NULL, 0);
+#elif defined(LINUX)
+ physMemSize = (TINT64)sysconf(_SC_PHYS_PAGES) * (TINT64)sysconf(_SC_PAGE_SIZE);
+
+#else
+#warning "Unsupported platform!"
+ physMemSize = 500000000;
+#endif
+
hwInfo.m_cpuCount = TSystem::getProcessorCount();
//We can just retrieve the overall physical memory - the rest is defaulted to 500 MB