I am trying to precisely measure the total amount of memory used by my application. I am developing a .so library that utilizes GPUs on the phone devices. I am mostly using C/C++ and OpenCL in my development, hence, all my memory allocations are either new/delete
or clCreateBuffer/clReleaseMemObject
.
Precisely, I am looking for the following values:
- Total memory used on the heap
- Total memory used on the stack (if possible)
- Total memory used for the OpenCL buffers
What I did:
I used dumpsys
to collect some numbers using the following command:
adb shell dumpsys meminfo com.example.hellolibs.debug -d
And, I also wrote some simple profiling code to track all the OpenCL buffer allocations/frees (I am tracking the reference counters of the underlying OpenCL buffers). The total memory usage that I am measuring using my profiling code is bigger than what dumpsys
is reporting using the above command. It shouldn't be like that, right?
My target platform is: ARM CPUs with Mali GPUs