Title: [261543] trunk/Source
Revision
261543
Author
basuke.suz...@sony.com
Date
2020-05-11 20:06:23 -0700 (Mon, 11 May 2020)

Log Message

[bmalloc][WTF] Add computing memory size implementation for FreeBSD
https://bugs.webkit.org/show_bug.cgi?id=211749

Reviewed by David Kilzer.

Source/bmalloc:

* bmalloc/AvailableMemory.cpp:
(bmalloc::computeAvailableMemory):

Source/WTF:

Share sysinfo(3) implementation with Linux and FreeBSD.

* wtf/RAMSize.cpp:
(WTF::computeRAMSize):

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (261542 => 261543)


--- trunk/Source/WTF/ChangeLog	2020-05-12 03:04:10 UTC (rev 261542)
+++ trunk/Source/WTF/ChangeLog	2020-05-12 03:06:23 UTC (rev 261543)
@@ -1,3 +1,15 @@
+2020-05-11  Basuke Suzuki  <basuke.suz...@sony.com>
+
+        [bmalloc][WTF] Add computing memory size implementation for FreeBSD
+        https://bugs.webkit.org/show_bug.cgi?id=211749
+
+        Reviewed by David Kilzer.
+
+        Share sysinfo(3) implementation with Linux and FreeBSD.
+
+        * wtf/RAMSize.cpp:
+        (WTF::computeRAMSize):
+
 2020-05-11  Mark Lam  <mark....@apple.com>
 
         Introduce WTF::Config and put Signal.cpp's init-once globals in it.

Modified: trunk/Source/WTF/wtf/RAMSize.cpp (261542 => 261543)


--- trunk/Source/WTF/wtf/RAMSize.cpp	2020-05-12 03:04:10 UTC (rev 261542)
+++ trunk/Source/WTF/wtf/RAMSize.cpp	2020-05-12 03:06:23 UTC (rev 261543)
@@ -54,14 +54,14 @@
     if (!result)
         return ramSizeGuess;
     return status.ullTotalPhys;
-#elif defined(USE_SYSTEM_MALLOC) && USE_SYSTEM_MALLOC
-#if OS(LINUX)
+#elif USE(SYSTEM_MALLOC)
+#if OS(LINUX) || OS(FREEBSD)
     struct sysinfo si;
     sysinfo(&si);
     return si.totalram * si.mem_unit;
 #else
 #error "Missing a platform specific way of determining the available RAM"
-#endif // OS(LINUX)
+#endif // OS(LINUX) || OS(FREEBSD)
 #else
     return bmalloc::api::availableMemory();
 #endif

Modified: trunk/Source/bmalloc/ChangeLog (261542 => 261543)


--- trunk/Source/bmalloc/ChangeLog	2020-05-12 03:04:10 UTC (rev 261542)
+++ trunk/Source/bmalloc/ChangeLog	2020-05-12 03:06:23 UTC (rev 261543)
@@ -1,3 +1,13 @@
+2020-05-11  Basuke Suzuki  <basuke.suz...@sony.com>
+
+        [bmalloc][WTF] Add computing memory size implementation for FreeBSD
+        https://bugs.webkit.org/show_bug.cgi?id=211749
+
+        Reviewed by David Kilzer.
+
+        * bmalloc/AvailableMemory.cpp:
+        (bmalloc::computeAvailableMemory):
+
 2020-05-09  Don Olmstead  <don.olmst...@sony.com>
 
         [CMake] Use WEBKIT_EXECUTABLE in MallocBench

Modified: trunk/Source/bmalloc/bmalloc/AvailableMemory.cpp (261542 => 261543)


--- trunk/Source/bmalloc/bmalloc/AvailableMemory.cpp	2020-05-12 03:04:10 UTC (rev 261542)
+++ trunk/Source/bmalloc/bmalloc/AvailableMemory.cpp	2020-05-12 03:06:23 UTC (rev 261543)
@@ -50,6 +50,7 @@
 #elif BOS(FREEBSD)
 #include "VMAllocate.h"
 #include <sys/sysctl.h>
+#include <sys/sysinfo.h>
 #include <sys/types.h>
 #include <sys/user.h>
 #endif
@@ -168,6 +169,11 @@
     return ((sizeAccordingToKernel + multiple - 1) / multiple) * multiple;
 #elif BOS(LINUX)
     return LinuxMemory::singleton().availableMemory;
+#elif BOS(FREEBSD)
+    struct sysinfo info;
+    if (!sysinfo(&info))
+        return info.totalram * info.mem_unit;
+    return availableMemoryGuess;
 #elif BOS(UNIX)
     long pages = sysconf(_SC_PHYS_PAGES);
     long pageSize = sysconf(_SC_PAGE_SIZE);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to