Explicitly handle memlimit_active < 0
authorsbarati@apple.com <sbarati@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 Jul 2018 21:20:22 +0000 (21:20 +0000)
committersbarati@apple.com <sbarati@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 Jul 2018 21:20:22 +0000 (21:20 +0000)
https://bugs.webkit.org/show_bug.cgi?id=188125

Reviewed by Mark Lam.

This may come up during development when someone wants the limit
to be "infinite".

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

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234328 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/bmalloc/ChangeLog
Source/bmalloc/bmalloc/AvailableMemory.cpp

index e4d5bec..84392c9 100644 (file)
@@ -1,5 +1,18 @@
 2018-07-27  Saam Barati  <sbarati@apple.com>
 
+        Explicitly handle memlimit_active < 0
+        https://bugs.webkit.org/show_bug.cgi?id=188125
+
+        Reviewed by Mark Lam.
+
+        This may come up during development when someone wants the limit
+        to be "infinite".
+
+        * bmalloc/AvailableMemory.cpp:
+        (bmalloc::jetsamLimit):
+
+2018-07-27  Saam Barati  <sbarati@apple.com>
+
         Use SPI to compute the jetsam limit on iOS instead of hardcoding 840MB
         https://bugs.webkit.org/show_bug.cgi?id=188091
         <rdar://problem/42647697>
index 1ef3d89..a55b468 100644 (file)
@@ -82,6 +82,8 @@ static size_t jetsamLimit()
     pid_t pid = getpid();
     if (memorystatus_control(MEMORYSTATUS_CMD_GET_MEMLIMIT_PROPERTIES, pid, 0, &properties, sizeof(properties)))
         return 840 * bmalloc::MB;
+    if (properties.memlimit_active < 0)
+        return std::numeric_limits<size_t>::max();
     return static_cast<size_t>(properties.memlimit_active) * bmalloc::MB;
 }
 #endif