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

Commit 0e0eb496 authored by Shai Barack's avatar Shai Barack Committed by Android (Google) Code Review
Browse files

Merge "Round up to the nearest page size when registering native memory with the VM." into main

parents d896298f 2a661509
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -379,6 +379,12 @@ public final class SharedMemory implements Parcelable, Closeable {
        private int mReferenceCount;

        private MemoryRegistration(int size) {
            // Round up to the nearest page size
            final int PAGE_SIZE = OsConstants._SC_PAGE_SIZE;
            final int remainder = size % PAGE_SIZE;
            if (remainder != 0) {
                size += PAGE_SIZE - remainder;
            }
            mSize = size;
            mReferenceCount = 1;
            VMRuntime.getRuntime().registerNativeAllocation(mSize);