[VD] Set hard limit for external memory increment 19/309119/3
authorJinwoo Kwon <j83.kwon@samsung.com>
Fri, 5 Apr 2024 04:16:13 +0000 (04:16 +0000)
committerBot Blink <blinkbot@samsung.com>
Mon, 20 May 2024 05:04:31 +0000 (05:04 +0000)
In M94, garbage collection for ArrayBuffer's backing
store is not frequently called enough on media playback
scenario. This results in PSS memory hitting the
limit of our product.

This is due to the V8's logic, which dynamically increases
and decreases the limit of external memory.

When the external memory limit is increased too much,
then V8 will not trigger a GC that clears external memory,
resulting this issue.

This patch sets a 300MB hard limit for external memory limit so
that invoking external memory GC is guaranteed.

Change-Id: Ief1555741b54b5a33937f7438cde64f06d5c8294
Signed-off-by: Jinwoo Kwon <j83.kwon@samsung.com>
v8/src/heap/heap.h

index eacb79ddf8a5b20fcc7e0e68988c6dd4bdd806c4..36808d6a6504c00d70fa334c882aca995a5f4f81 100644 (file)
@@ -332,7 +332,17 @@ class Heap {
       total_.store(value, std::memory_order_relaxed);
     }
 
+#if defined(OS_TIZEN_TV_PRODUCT)
+    // 300MB was decided to minify the GC call for meeting threshold
+    static constexpr int kExternalAllocationHardLimit = 300 * 1024 * 1024;
+#endif
+
     void set_limit(int64_t value) {
+#if defined(OS_TIZEN_TV_PRODUCT)
+      if (value > kExternalAllocationHardLimit) {
+        return;
+      }
+#endif
       limit_.store(value, std::memory_order_relaxed);
     }