0

I have a video processing program on Android and I want to buffer as much as possible. But to do that, I need to know how much free memory is available. I'm using OpenCV, so I need to know how much available native memory there is. Is this possible on Android? Ideally it would be done from Java, but a native code solution would also be helpful.

It has to be pretty fast since I would like to check the amount of free memory 10-30 times per second.

I've seen a lot of SO questions about native memory on Android, but none that I could find addressed this specific issue.

Chris
  • 4,734
  • 2
  • 19
  • 26
  • Have you seen: https://developer.android.com/topic/performance/memory – Morrison Chang Jan 14 '20 at 21:21
  • I have seen it, thanks. It doesn't seem to be about native memory, though, except maybe `onTrimMemory`, and that looks like it mainly applys to apps that have been backgrounded. – Chris Jan 15 '20 at 15:23
  • Have you seen: https://developer.android.com/studio/profile/memory-profiler and https://source.android.com/devices/tech/debug/native-memory. Also I would check for possibly appropriate Google IO videos like: [How to Manage Native C++ Memory in Android (Google I/O '17)](https://youtu.be/7_caITSjk1k) and [Understanding Android memory usage (Google I/O '18)](https://youtu.be/w7K0jio8afM). Also realize that what you asking for is similar to games so look for questions like [How does Bitmap allocation work on Oreo, and how to investigate their memory?](https://stackoverflow.com/q/48091403/295004) – Morrison Chang Jan 15 '20 at 19:15

0 Answers0