Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fac857dd authored by Egor Pasko's avatar Egor Pasko Committed by Egor Pasko
Browse files

Bump x86 WebView zygote reservation size to 190MiB

The current 130MiB is not sufficient for the latest Chrome x86 dev build
of stripped native library. Official ARM library is around 59 MiB (on
disk). This flavor is slower to build and is less convenient to test
with.

Keep the 32bit arm reservation size unchanged, it is sufficient and
allows growth.

Bug: 184808875
Test: Manual: start a "release" build of Chrome/x86 (but not
      "official"), observe that with the change Chrome can
      mmap(MAP_FIXED) all the segments of the native library into the
      region successfully

Change-Id: I00507169eafbdcfc4d413bb9c76188e179ca0c0e
parent 888f9644
Loading
Loading
Loading
Loading
+17 −6
Original line number Diff line number Diff line
@@ -178,12 +178,23 @@ public class WebViewLibraryLoader {
     */
    static void reserveAddressSpaceInZygote() {
        System.loadLibrary("webviewchromium_loader");
        boolean is64Bit = VMRuntime.getRuntime().is64Bit();
        long addressSpaceToReserve;
        if (VMRuntime.getRuntime().is64Bit()) {
            // On 64-bit address space is really cheap and we can reserve 1GB which is plenty.
        // On 32-bit it's fairly scarce and we should keep it to a realistic number that
        // permits some future growth but doesn't hog space: we use 130MB which is roughly
        // what was calculated on older OS versions in practice.
        long addressSpaceToReserve = is64Bit ? 1 * 1024 * 1024 * 1024 : 130 * 1024 * 1024;
            addressSpaceToReserve = 1 * 1024 * 1024 * 1024;
        } else if (VMRuntime.getRuntime().vmInstructionSet().equals("arm")) {
            // On 32-bit the address space is fairly scarce, hence we should keep it to a realistic
            // number that permits some future growth but doesn't hog space. For ARM we use 130MB
            // which is roughly what was calculated on older OS versions. The size has been
            // growing gradually, but a few efforts have offset it back to the size close to the
            // original.
            addressSpaceToReserve = 130 * 1024 * 1024;
        } else {
            // The number below was obtained for a binary used for x86 emulators, allowing some
            // natural growth.
            addressSpaceToReserve = 190 * 1024 * 1024;
        }

        sAddressSpaceReserved = nativeReserveAddressSpace(addressSpaceToReserve);

        if (sAddressSpaceReserved) {