title: Measuring memory used by OpenCl on Android
body: <h1>tl;dr</h1>
  
  <p>I want to measure the memory usage of my OpenCL application running on Android. Is there a reliable method for doing so?  </p>
  
  <h1>Full story</h1>
  
  <p>I tried <code>adb shell dumpsys meminfo</code>, Android Studio's profiler and <code>pmap</code> on the device. It seems that both <code>meminfo</code> and Android Studio's profiler are off by the factor of 2 and the <code>pmap</code> on the device gives unreliable data.</p>
  
  <p>Consider following code which sets up OpenCL and allocates a 4096x576 image.</p>
  
  <pre class="lang-cpp prettyprint-override"><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;
  
  #define CL_HPP_TARGET_OPENCL_VERSION 200
  
  #include &lt;CL/cl2.hpp&gt;
  
  int main() {
    std::vector&lt;cl::Platform&gt; platforms;
    cl::Platform::get(&amp;platforms);
    cl::Platform platform = platforms[0];
  
    std::vector&lt;cl::Device&gt; all_devices;
    platform.getDevices(CL_DEVICE_TYPE_ALL, &amp;all_devices);
  
  
    cl::Device device = all_devices[0];
    cl_int err;
    cl::Context context({device}, nullptr, nullptr, nullptr, &amp;err);
    if (err != CL_SUCCESS) {
      std::cerr &lt;&lt; "error: " &lt;&lt; err &lt;&lt; std::endl;
      exit(1);
    }
  
    cl::CommandQueue queue(context, all_devices[0], 0, &amp;err);
    if (err != CL_SUCCESS) {
      std::cerr &lt;&lt; "error: " &lt;&lt; err &lt;&lt; std::endl;
      exit(1);
    }
  
    //////////////// (1) //////////////////
    std::cin.get();
  
  
    cl::ImageFormat img_format(CL_RGBA, CL_FLOAT);
    auto *x = new cl::Image2D(context, CL_MEM_READ_WRITE | CL_MEM_ALLOC_HOST_PTR, img_format,
                4096, 576, 0, nullptr, &amp;err);
    if (err != CL_SUCCESS) {
      std::cerr &lt;&lt; "error: " &lt;&lt; err &lt;&lt; std::endl;
      exit(1);
    }
  
    cl::Event event;
    cl_float4 color{0.7, 0.7, 0.7, 0.7};
  
    queue.enqueueFillImage(*x, color, {0, 0, 0}, {4096, 576, 1}, nullptr, &amp;event);
    event.wait();
  
    ///////////////////// (2) //////////////
    std::cin.get();
  
    return 0;
  }
  </code></pre>
  
  <p>I have measured the memory usage before each <code>cin.get()</code> i.e. at points in code marked by (1) and (2). Between these points I am allocating a 4096x576 image in the rgba format, so that each pixel consists of 4 floats. Expected memory usage is 4096*576*4*4 = 36MB. Yet, the difference in total memory usage reported by <code>adb shell dumpsys meminfo</code> is 72MB. </p>
  
  <p>The output of Android Studio's profiler seem to more or less agree with what I gathered by <code>meminfo</code>.</p>
  
  <p>To make it funnier when I <code>adb shell</code>ed into the device and compared  <code>pmap</code> outputs at points (1) and (2) I have got difference of total memory equal to 36MB - exactly the value I was expecting, but <code>pmap</code> on two subsequent runs gives wildly different memory usage. (The difference between (1) and (2) is constant, though).</p>
  
  <h1>My question</h1>
  
  <p>Does any of these two methods gives accurate memory usage? If not, how can I get the real memory usage of such app?</p>
  
  <h1>Additional data</h1>
  
  <p>Code above is compiled with android-ndk-r20 by running </p>
  
  <pre class="lang-sh prettyprint-override"><code>cmake -DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake \ android.toolchain.cmake \
      -DCMAKE_SYSTEM_NAME=Android \
       -DCMAKE_SYSTEM_VERSION=23 \
      -DANDROID_ABI="armeabi-v7a" \
      -DANDROID_TOOLCHAIN=clang \
      -DCMAKE_BUILD_TYPE=Release \
      -DOpenCL_LIBRARY=${OPENCL}/libOpenCL.so \
      -DOpenCL_INCLUDE_DIR=${OPENCL} \
       ..
  </code></pre>
  
  <p>with the following <code>CMakeLists.txt</code>:</p>
  
  <pre><code>cmake_minimum_required(VERSION 3.10)
  project(open_cl_test)
  
  set(CMAKE_CXX_STANDARD 17)
  
  find_package(OpenCL REQUIRED)
  
  add_executable(open_cl_test main.cpp)
  message(STATUS ${OpenCL_LIBRARY})
  include_directories(${OpenCL_INCLUDE_DIR})
  target_link_libraries(open_cl_test ${OpenCL_LIBRARY})
  </code></pre>
  
  <p>exact output from <code>meminfo</code> at (1):</p>
  
  <pre><code>Applications Memory Usage (in Kilobytes):
  Uptime: 1587044222 Realtime: 3641071359
                     Pss  Private  Private  SwapPss     Heap     Heap     Heap
                   Total    Dirty    Clean    Dirty     Size    Alloc     Free
                  ------   ------   ------   ------   ------   ------   ------
    Native Heap      212      212        0        0        0        0        0
    Dalvik Heap        0        0        0        0        0        0        0
          Stack       28       28        0        0                           
        Gfx dev       36       36        0        0                           
      Other dev        0        0        0        0                           
       .so mmap     1544      864      604        0                           
     Other mmap      119       28       84        0                           
      GL mtrack     4388     4388        0        0                           
        Unknown      208      208        0        0                           
          TOTAL     6535     5764      688        0        0        0        0
  
   App Summary
                         Pss(KB)
                          ------
             Java Heap:        0
           Native Heap:      212
                  Code:     1468
                 Stack:       28
              Graphics:     4424
         Private Other:      320
                System:       83
  
                 TOTAL:     6535       TOTAL SWAP PSS:        0
  </code></pre>
  
  <p>and at (2):</p>
  
  <pre><code>Applications Memory Usage (in Kilobytes):
  Uptime: 1587054603 Realtime: 3641081740
                     Pss  Private  Private  SwapPss     Heap     Heap     Heap
                   Total    Dirty    Clean    Dirty     Size    Alloc     Free
                  ------   ------   ------   ------   ------   ------   ------
    Native Heap      216      216        0        0        0        0        0
    Dalvik Heap        0        0        0        0        0        0        0
          Stack       28       28        0        0                           
        Gfx dev    36948    36804      144        0                           
      Other dev        0        0        0        0                           
       .so mmap     1618      864      648        0                           
     Other mmap      119       28       84        0                           
      GL mtrack    41276    41276        0        0                           
        Unknown      208      208        0        0                           
          TOTAL    80413    79424      876        0        0        0        0
  
   App Summary
                         Pss(KB)
                          ------
             Java Heap:        0
           Native Heap:      216
                  Code:     1512
                 Stack:       28
              Graphics:    78224
         Private Other:      320
                System:      113
  
                 TOTAL:    80413       TOTAL SWAP PSS:        0
  
  </code></pre>
  
  <p><code>pmap</code> output at (1):</p>
  
  <pre><code>0000000001a98000    172K r-x--  /data/local/tmp/opencltest/open_cl_test
  0000000001ac3000     12K r----  /data/local/tmp/opencltest/open_cl_test
  0000000001ac6000      4K rw---  /data/local/tmp/opencltest/open_cl_test
  0000000001ac7000   8700K -----    [heap]
  00000000bebac000     48K rw-s-  /dev/kgsl-3d0
  00000000bebb8000     96K rw-s-  /dev/kgsl-3d0
  00000000bebd0000   1024K rw-s-  /dev/kgsl-3d0
  00000000becd0000   1024K rw-s-  /dev/kgsl-3d0
  00000000bedd0000     64K rw-s-  /dev/kgsl-3d0
  00000000bede0000     64K rw-s-  /dev/kgsl-3d0
  00000000bedf2000      4K rw-s-  /dev/kgsl-3d0
  00000000bedf3000      8K rw-s-  /dev/kgsl-3d0
  00000000bedf5000      8K rw-s-  /dev/kgsl-3d0
  00000000bedf7000      4K rw-s-  /dev/kgsl-3d0
  00000000bedf8000   2056K rw-s-  /dev/kgsl-3d0
  00000000beffa000      4K rw-s-  /dev/kgsl-3d0
  00000000beffb000     20K rw-s-  /dev/kgsl-3d0
  00000000e3086000      4K -----    [anon:thread stack guard page]
  00000000e3087000   1008K rw---    [anon]
  00000000e3183000      4K -----    [anon:thread stack guard page]
  00000000e3184000   1008K rw---    [anon]
  00000000e3280000    512K rw---    [anon:libc_malloc]
  00000000e3346000  21612K r-x--  /vendor/lib/libllvm-qcom.so
  00000000e4861000    272K r----  /vendor/lib/libllvm-qcom.so
  00000000e48a5000    392K rw---  /vendor/lib/libllvm-qcom.so
  00000000e4907000     36K rw---    [anon:.bss]
  00000000e4946000     80K r-x--  /system/lib/libunwind.so
  00000000e495a000      4K -----    [anon]
  00000000e495b000      4K r----  /system/lib/libunwind.so
  00000000e495c000      4K rw---  /system/lib/libunwind.so
  00000000e495d000    280K rw---    [anon:.bss]
  00000000e49e4000     12K r-x--  /system/lib/libvndksupport.so
  00000000e49e7000      4K r----  /system/lib/libvndksupport.so
  00000000e49e8000      4K rw---  /system/lib/libvndksupport.so
  00000000e4a1c000     88K r-x--  /system/lib/liblzma.so
  00000000e4a32000      4K -----    [anon]
  00000000e4a33000      4K r----  /system/lib/liblzma.so
  00000000e4a34000      4K rw---  /system/lib/liblzma.so
  00000000e4a35000     24K rw---    [anon:.bss]
  00000000e4a68000     80K r-x--  /system/lib/libbacktrace.so
  00000000e4a7c000      4K r----  /system/lib/libbacktrace.so
  00000000e4a7d000      4K rw---  /system/lib/libbacktrace.so
  00000000e4a88000   1124K r-x--  /vendor/lib/libCB.so
  00000000e4ba1000     28K r----  /vendor/lib/libCB.so
  00000000e4ba8000      8K rw---  /vendor/lib/libCB.so
  00000000e4baa000      8K rw---    [anon:.bss]
  00000000e4be8000     60K r-x--  /system/lib/libbase.so
  00000000e4bf7000      4K r----  /system/lib/libbase.so
  00000000e4bf8000      4K rw---  /system/lib/libbase.so
  00000000e4c13000     88K r-x--  /system/lib/libutils.so
  00000000e4c29000      4K r----  /system/lib/libutils.so
  00000000e4c2a000      4K rw---  /system/lib/libutils.so
  00000000e4c47000   1276K r-x--  /vendor/lib/libgsl.so
  00000000e4d86000      4K r----  /vendor/lib/libgsl.so
  00000000e4d87000      4K rw---  /vendor/lib/libgsl.so
  00000000e4d88000      4K rw---    [anon:.bss]
  00000000e4dc4000     12K r-x--  /system/lib/libsync.so
  00000000e4dc7000      4K r----  /system/lib/libsync.so
  00000000e4dc8000      4K rw---  /system/lib/libsync.so
  00000000e4e20000     88K r-x--  /system/lib/libz.so
  00000000e4e36000      4K -----    [anon]
  00000000e4e37000      4K r----  /system/lib/libz.so
  00000000e4e38000      4K rw---  /system/lib/libz.so
  00000000e4e42000     16K r-x--  /system/lib/libnetd_client.so
  00000000e4e46000      4K r----  /system/lib/libnetd_client.so
  00000000e4e47000      4K rw---  /system/lib/libnetd_client.so
  00000000e4e80000   1024K rw---    [anon:libc_malloc]
  00000000e4fd0000     12K r-x--  /system/lib/libdl.so
  00000000e4fd3000      4K r----  /system/lib/libdl.so
  00000000e4fd4000      4K rw---  /system/lib/libdl.so
  00000000e4fd5000      4K rw---    [anon:.bss]
  00000000e501a000    556K r-x--  /system/lib/libc++.so
  00000000e50a5000      4K -----    [anon]
  00000000e50a6000     16K r----  /system/lib/libc++.so
  00000000e50aa000      4K rw---  /system/lib/libc++.so
  00000000e50ab000      4K rw---    [anon:.bss]
  00000000e50cb000     64K r-x--  /vendor/lib/libOpenCL.so
  00000000e50db000      4K r----  /vendor/lib/libOpenCL.so
  00000000e50dc000      4K rw---  /vendor/lib/libOpenCL.so
  00000000e50f3000    128K r--s-  /dev/__properties__/u:object_r:debug_prop:s0
  00000000e5113000     52K r-x--  /system/lib/libcutils.so
  00000000e5120000      4K -----    [anon]
  00000000e5121000      4K r----  /system/lib/libcutils.so
  00000000e5122000      4K rw---  /system/lib/libcutils.so
  00000000e513c000    128K r--s-  /dev/__properties__/u:object_r:persist_dpm_prop:s0
  00000000e515c000     72K r-x--  /system/lib/liblog.so
  00000000e516e000      4K r----  /system/lib/liblog.so
  00000000e516f000      4K rw---  /system/lib/liblog.so
  00000000e517e000    128K r--s-  /dev/__properties__/u:object_r:default_prop:s0
  00000000e519e000    128K r-x--  /system/lib/libm.so
  00000000e51be000      4K r----  /system/lib/libm.so
  00000000e51bf000      4K rw---  /system/lib/libm.so
  00000000e51c8000    568K r-x--  /system/lib/libc.so
  00000000e5256000     16K r----  /system/lib/libc.so
  00000000e525a000      8K rw---  /system/lib/libc.so
  00000000e525c000      4K rw---    [anon:.bss]
  00000000e525d000      4K r----    [anon:.bss]
  00000000e525e000     24K rw---    [anon:.bss]
  00000000e527d000      4K r----    [anon:atexit handlers]
  00000000e527e000    128K r--s-  /dev/__properties__/properties_serial
  00000000e529e000      4K rw---    [anon:linker_alloc]
  00000000e52b2000      4K r----    [anon:linker_alloc]
  00000000e52c5000      4K rw---    [anon:arc4random data]
  00000000e52d3000      4K -----    [anon:thread signal stack guard page]
  00000000e52d4000     16K rw---    [anon:thread signal stack]
  00000000e52d8000      4K -----    [anon:bionic TLS guard]
  00000000e52d9000     12K rw---    [anon:bionic TLS]
  00000000e52dc000      4K -----    [anon:bionic TLS guard]
  00000000e52dd000      4K -----    [anon:thread signal stack guard page]
  00000000e52de000     16K rw---    [anon:thread signal stack]
  00000000e52e2000      4K rw---    [anon:linker_alloc_small_objects]
  00000000e52e5000      4K -----    [anon:bionic TLS guard]
  00000000e52e6000     12K rw---    [anon:bionic TLS]
  00000000e52e9000      4K -----    [anon:bionic TLS guard]
  00000000e52ea000      4K r----    [anon:atexit handlers]
  00000000e52eb000      8K r--s-  /dev/kgsl-3d0
  00000000e52ed000      4K rw---    [anon:linker_alloc_vector]
  00000000e52ee000      4K r----    [anon:linker_alloc]
  00000000e52ef000      4K rw---    [anon:linker_alloc]
  00000000e52f0000    128K r--s-  /dev/__properties__/u:object_r:default_prop:s0
  00000000e5310000    128K r--s-  /dev/__properties__/u:object_r:debug_prop:s0
  00000000e5330000    128K r--s-  /dev/__properties__/properties_serial
  00000000e5350000      8K rw---    [anon:linker_alloc_vector]
  00000000e5352000      4K r----    [anon:linker_alloc]
  00000000e5353000      4K rw---    [anon:linker_alloc_small_objects]
  00000000e5354000      4K rw---    [anon:linker_alloc_vector]
  00000000e5355000      4K rw---    [anon:linker_alloc_small_objects]
  00000000e5356000      4K rw---    [anon:linker_alloc_vector]
  00000000e5357000      4K -----    [anon]
  00000000e5358000      4K rw---    [anon]
  00000000e5359000      4K -----    [anon]
  00000000e535a000      4K rw---    [anon:linker_alloc_lob]
  00000000e535b000      4K r----    [anon:linker_alloc]
  00000000e535c000     16K rw---    [anon:linker_alloc_small_objects]
  00000000e5360000      4K r----    [anon:atexit handlers]
  00000000e5361000      4K -----    [anon:thread signal stack guard page]
  00000000e5362000     16K rw---    [anon:thread signal stack]
  00000000e5366000      4K -----    [anon:bionic TLS guard]
  00000000e5367000     12K rw---    [anon:bionic TLS]
  00000000e536a000      4K -----    [anon:bionic TLS guard]
  00000000e536b000    544K r-x--  /system/bin/linker
  00000000e53f3000      4K rw---    [anon:arc4random data]
  00000000e53f4000      8K r----  /system/bin/linker
  00000000e53f6000      4K rw---  /system/bin/linker
  00000000e53f7000    288K rw---    [anon]
  00000000e543f000      4K r----    [anon]
  00000000e5440000     24K rw---    [anon]
  00000000f9bde000    136K rw---    [stack]
  00000000f9c00000  102336K -----    [anon]
  00000000ffff0000      4K r-x--    [vectors]
  total            148616K
  </code></pre>
  
  <p>at (2):</p>
  
  <pre><code>27417: ./open_cl_test
  0000000001a98000    172K r-x--  /data/local/tmp/opencltest/open_cl_test
  0000000001ac3000     12K r----  /data/local/tmp/opencltest/open_cl_test
  0000000001ac6000      4K rw---  /data/local/tmp/opencltest/open_cl_test
  0000000001ac7000   8700K -----    [heap]
  00000000bc7a3000  36900K rw-s-  /dev/kgsl-3d0
  00000000bebac000     48K rw-s-  /dev/kgsl-3d0
  00000000bebb8000     96K rw-s-  /dev/kgsl-3d0
  00000000bebd0000   1024K rw-s-  /dev/kgsl-3d0
  00000000becd0000   1024K rw-s-  /dev/kgsl-3d0
  00000000bedd0000     64K rw-s-  /dev/kgsl-3d0
  00000000bede0000     64K rw-s-  /dev/kgsl-3d0
  00000000bedf2000      4K rw-s-  /dev/kgsl-3d0
  00000000bedf3000      8K rw-s-  /dev/kgsl-3d0
  00000000bedf5000      8K rw-s-  /dev/kgsl-3d0
  00000000bedf7000      4K rw-s-  /dev/kgsl-3d0
  00000000bedf8000   2056K rw-s-  /dev/kgsl-3d0
  00000000beffa000      4K rw-s-  /dev/kgsl-3d0
  00000000beffb000     20K rw-s-  /dev/kgsl-3d0
  00000000e3086000      4K -----    [anon:thread stack guard page]
  00000000e3087000   1008K rw---    [anon]
  00000000e3183000      4K -----    [anon:thread stack guard page]
  00000000e3184000   1008K rw---    [anon]
  00000000e3280000    512K rw---    [anon:libc_malloc]
  00000000e3346000  21612K r-x--  /vendor/lib/libllvm-qcom.so
  00000000e4861000    272K r----  /vendor/lib/libllvm-qcom.so
  00000000e48a5000    392K rw---  /vendor/lib/libllvm-qcom.so
  00000000e4907000     36K rw---    [anon:.bss]
  00000000e4946000     80K r-x--  /system/lib/libunwind.so
  00000000e495a000      4K -----    [anon]
  00000000e495b000      4K r----  /system/lib/libunwind.so
  00000000e495c000      4K rw---  /system/lib/libunwind.so
  00000000e495d000    280K rw---    [anon:.bss]
  00000000e49e4000     12K r-x--  /system/lib/libvndksupport.so
  00000000e49e7000      4K r----  /system/lib/libvndksupport.so
  00000000e49e8000      4K rw---  /system/lib/libvndksupport.so
  00000000e4a1c000     88K r-x--  /system/lib/liblzma.so
  00000000e4a32000      4K -----    [anon]
  00000000e4a33000      4K r----  /system/lib/liblzma.so
  00000000e4a34000      4K rw---  /system/lib/liblzma.so
  00000000e4a35000     24K rw---    [anon:.bss]
  00000000e4a68000     80K r-x--  /system/lib/libbacktrace.so
  00000000e4a7c000      4K r----  /system/lib/libbacktrace.so
  00000000e4a7d000      4K rw---  /system/lib/libbacktrace.so
  00000000e4a88000   1124K r-x--  /vendor/lib/libCB.so
  00000000e4ba1000     28K r----  /vendor/lib/libCB.so
  00000000e4ba8000      8K rw---  /vendor/lib/libCB.so
  00000000e4baa000      8K rw---    [anon:.bss]
  00000000e4be8000     60K r-x--  /system/lib/libbase.so
  00000000e4bf7000      4K r----  /system/lib/libbase.so
  00000000e4bf8000      4K rw---  /system/lib/libbase.so
  00000000e4c13000     88K r-x--  /system/lib/libutils.so
  00000000e4c29000      4K r----  /system/lib/libutils.so
  00000000e4c2a000      4K rw---  /system/lib/libutils.so
  00000000e4c47000   1276K r-x--  /vendor/lib/libgsl.so
  00000000e4d86000      4K r----  /vendor/lib/libgsl.so
  00000000e4d87000      4K rw---  /vendor/lib/libgsl.so
  00000000e4d88000      4K rw---    [anon:.bss]
  00000000e4dc4000     12K r-x--  /system/lib/libsync.so
  00000000e4dc7000      4K r----  /system/lib/libsync.so
  00000000e4dc8000      4K rw---  /system/lib/libsync.so
  00000000e4e20000     88K r-x--  /system/lib/libz.so
  00000000e4e36000      4K -----    [anon]
  00000000e4e37000      4K r----  /system/lib/libz.so
  00000000e4e38000      4K rw---  /system/lib/libz.so
  00000000e4e42000     16K r-x--  /system/lib/libnetd_client.so
  00000000e4e46000      4K r----  /system/lib/libnetd_client.so
  00000000e4e47000      4K rw---  /system/lib/libnetd_client.so
  00000000e4e80000   1024K rw---    [anon:libc_malloc]
  00000000e4fd0000     12K r-x--  /system/lib/libdl.so
  00000000e4fd3000      4K r----  /system/lib/libdl.so
  00000000e4fd4000      4K rw---  /system/lib/libdl.so
  00000000e4fd5000      4K rw---    [anon:.bss]
  00000000e501a000    556K r-x--  /system/lib/libc++.so
  00000000e50a5000      4K -----    [anon]
  00000000e50a6000     16K r----  /system/lib/libc++.so
  00000000e50aa000      4K rw---  /system/lib/libc++.so
  00000000e50ab000      4K rw---    [anon:.bss]
  00000000e50cb000     64K r-x--  /vendor/lib/libOpenCL.so
  00000000e50db000      4K r----  /vendor/lib/libOpenCL.so
  00000000e50dc000      4K rw---  /vendor/lib/libOpenCL.so
  00000000e50f3000    128K r--s-  /dev/__properties__/u:object_r:debug_prop:s0
  00000000e5113000     52K r-x--  /system/lib/libcutils.so
  00000000e5120000      4K -----    [anon]
  00000000e5121000      4K r----  /system/lib/libcutils.so
  00000000e5122000      4K rw---  /system/lib/libcutils.so
  00000000e513c000    128K r--s-  /dev/__properties__/u:object_r:persist_dpm_prop:s0
  00000000e515c000     72K r-x--  /system/lib/liblog.so
  00000000e516e000      4K r----  /system/lib/liblog.so
  00000000e516f000      4K rw---  /system/lib/liblog.so
  00000000e517e000    128K r--s-  /dev/__properties__/u:object_r:default_prop:s0
  00000000e519e000    128K r-x--  /system/lib/libm.so
  00000000e51be000      4K r----  /system/lib/libm.so
  00000000e51bf000      4K rw---  /system/lib/libm.so
  00000000e51c8000    568K r-x--  /system/lib/libc.so
  00000000e5256000     16K r----  /system/lib/libc.so
  00000000e525a000      8K rw---  /system/lib/libc.so
  00000000e525c000      4K rw---    [anon:.bss]
  00000000e525d000      4K r----    [anon:.bss]
  00000000e525e000     24K rw---    [anon:.bss]
  00000000e527d000      4K r----    [anon:atexit handlers]
  00000000e527e000    128K r--s-  /dev/__properties__/properties_serial
  00000000e529e000      4K rw---    [anon:linker_alloc]
  00000000e52b2000      4K r----    [anon:linker_alloc]
  00000000e52c5000      4K rw---    [anon:arc4random data]
  00000000e52d3000      4K -----    [anon:thread signal stack guard page]
  00000000e52d4000     16K rw---    [anon:thread signal stack]
  00000000e52d8000      4K -----    [anon:bionic TLS guard]
  00000000e52d9000     12K rw---    [anon:bionic TLS]
  00000000e52dc000      4K -----    [anon:bionic TLS guard]
  00000000e52dd000      4K -----    [anon:thread signal stack guard page]
  00000000e52de000     16K rw---    [anon:thread signal stack]
  00000000e52e2000      4K rw---    [anon:linker_alloc_small_objects]
  00000000e52e5000      4K -----    [anon:bionic TLS guard]
  00000000e52e6000     12K rw---    [anon:bionic TLS]
  00000000e52e9000      4K -----    [anon:bionic TLS guard]
  00000000e52ea000      4K r----    [anon:atexit handlers]
  00000000e52eb000      8K r--s-  /dev/kgsl-3d0
  00000000e52ed000      4K rw---    [anon:linker_alloc_vector]
  00000000e52ee000      4K r----    [anon:linker_alloc]
  00000000e52ef000      4K rw---    [anon:linker_alloc]
  00000000e52f0000    128K r--s-  /dev/__properties__/u:object_r:default_prop:s0
  00000000e5310000    128K r--s-  /dev/__properties__/u:object_r:debug_prop:s0
  00000000e5330000    128K r--s-  /dev/__properties__/properties_serial
  00000000e5350000      8K rw---    [anon:linker_alloc_vector]
  00000000e5352000      4K r----    [anon:linker_alloc]
  00000000e5353000      4K rw---    [anon:linker_alloc_small_objects]
  00000000e5354000      4K rw---    [anon:linker_alloc_vector]
  00000000e5355000      4K rw---    [anon:linker_alloc_small_objects]
  00000000e5356000      4K rw---    [anon:linker_alloc_vector]
  00000000e5357000      4K -----    [anon]
  00000000e5358000      4K rw---    [anon]
  00000000e5359000      4K -----    [anon]
  00000000e535a000      4K rw---    [anon:linker_alloc_lob]
  00000000e535b000      4K r----    [anon:linker_alloc]
  00000000e535c000     16K rw---    [anon:linker_alloc_small_objects]
  00000000e5360000      4K r----    [anon:atexit handlers]
  00000000e5361000      4K -----    [anon:thread signal stack guard page]
  00000000e5362000     16K rw---    [anon:thread signal stack]
  00000000e5366000      4K -----    [anon:bionic TLS guard]
  00000000e5367000     12K rw---    [anon:bionic TLS]
  00000000e536a000      4K -----    [anon:bionic TLS guard]
  00000000e536b000    544K r-x--  /system/bin/linker
  00000000e53f3000      4K rw---    [anon:arc4random data]
  00000000e53f4000      8K r----  /system/bin/linker
  00000000e53f6000      4K rw---  /system/bin/linker
  00000000e53f7000    288K rw---    [anon]
  00000000e543f000      4K r----    [anon]
  00000000e5440000     24K rw---    [anon]
  00000000f9bde000    136K rw---    [stack]
  00000000f9c00000  102336K -----    [anon]
  00000000ffff0000      4K r-x--    [vectors]
  total            185516K
  </code></pre>
  
  <p>and diff for convenience:</p>
  
  <pre><code>5a6
  &gt; 00000000bc7a3000  36900K rw-s-  /dev/kgsl-3d0
  152c153
  &lt; total            148616K
  ---
  &gt; total            185516K
  </code></pre>
  
  <p>On the second run <code>pmap</code> total at (1) was  173544K and at (2) 210444K, which is why I claim that this output is unreliable.</p>