| Server IP : 82.208.35.60 / Your IP : 216.73.217.33 Web Server : Apache/2.4.55 (FreeBSD) OpenSSL/1.1.1q-freebsd PHP/7.3.31 System : FreeBSD server7.d2m.cz 12.4-RELEASE-p9 FreeBSD 12.4-RELEASE-p9 GENERIC amd64 User : studiokobylisy_cz ( 1008) PHP Version : 7.3.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /usr/ports/www/webkit2-gtk4/files/ |
Upload File : |
--- Source/WTF/wtf/RAMSize.cpp.orig 2021-09-22 23:29:42 UTC
+++ Source/WTF/wtf/RAMSize.cpp
@@ -35,6 +35,8 @@
#include <sys/sysinfo.h>
#elif OS(UNIX)
#include <unistd.h>
+#include <sys/types.h>
+#include <sys/sysctl.h>
#endif // OS(LINUX) || OS(UNIX)
#else
#include <bmalloc/bmalloc.h>
@@ -56,14 +58,18 @@ static size_t computeRAMSize()
return ramSizeGuess;
return status.ullTotalPhys;
#elif USE(SYSTEM_MALLOC)
-#if OS(LINUX) || OS(FREEBSD)
+#if OS(LINUX)
struct sysinfo si;
sysinfo(&si);
return si.totalram * si.mem_unit;
#elif OS(UNIX)
- long pages = sysconf(_SC_PHYS_PAGES);
- long pageSize = sysconf(_SC_PAGE_SIZE);
- return pages * pageSize;
+ size_t physmem, len;
+ int mib[2] = { CTL_HW, HW_PHYSMEM };
+ if (sysctl(mib, 2, &physmem, &len, NULL, 0) == 0
+ && len == sizeof(physmem))
+ return physmem;
+ else
+ return 512 * MB; // guess
#else
#error "Missing a platform specific way of determining the available RAM"
#endif // OS(LINUX) || OS(FREEBSD) || OS(UNIX)