public long pageSizeBytes() {
        if (pageSize != 0) {
            return pageSize;
        }

        long minPageSize = (long) 1024 * 1024;   // 1MB
        long maxPageSize = 64L * minPageSize;  // 64MB
        int cores = Runtime.getRuntime().availableProcessors();
        // Because of rounding to next power of 2, we may have safetyFactor as 8 in worst case
        int safetyFactor = 16;
        long size = nextPowerOf2(maxOffHeapMemory / cores / safetyFactor);
        return Math.min(maxPageSize, Math.max(minPageSize, size));
    }
The default page size, in bytes.

If user didn't explicitly set "spark.buffer.pageSize", we figure out the default value
by looking at the number of cores available to the process, and the total amount of memory,
and then divide it by a factor of safety.
indexr-query-opt/src/main/java/org/apache/spark/memory/MemoryManager.java