General (Read-only)

G6 Android Oreo Camera Memory Leak
Spaeger
When programming an android app using camera2 api I stumbled across something that looks like a memory leak in your native code of the camera implementation.
When profiling my own app or the Camera2Basic sample from Google [https://github.com/googlesamples/android-Camera2Basic] with the latest version of Android Studio I found the memory usage of native constantly increasing. This does not seem to be present when running the Camera2Basic sample on my Lenovo tablet.
Interestingly it looks like the increase of memory usage seems to be higher when the preview shows a lot of changing content and seems to be lower when the camera is covered and the preview is black.
Posted on 28-May-2018
Spaeger

Re:G6 Android Oreo Camera Memory Leak

Additional information:

Model: LG-H870
Hardware-Revision: 1.0
Android Version: 8.0.0
Build-Number: OPR1.170623.032
Software Version: V20a-EUR-XX


Posted on 28-May-2018
narae0.kim

Re:G6 Android Oreo Camera Memory Leak

Hello,

Have you checked the other brands' phone models installed Android Oreo?

Thank you.


Posted on 29-May-2018
Spaeger

Re:G6 Android Oreo Camera Memory Leak

The other device is using Android 7.1.1. Unfortunately I do not have access to another device running Oreo.


Posted on 29-May-2018
Spaeger

Re:G6 Android Oreo Camera Memory Leak

A friend of mine tested both our App and the Camera2Basic Sample on a Nexus 5X running Android 8.1.
On this phone using Camera2Basic the GC collects at around 57MB native usage. With our own App this early collection does not seem to happen.

I also did further profiling on the G6. I found out, that both Camera2Basic and OpenCamera (using Camera2 in settings) show those signs of leakage. In both apps native usage grows over 150 or even over 200MB. At some time then, the memory gets collected, but while this happens the preview freezes for a moment. Our app seems to handle something differently because the preview just freezes (in this try at about 269MB Native usage) and does not go live anymore.
[Edit: I tested it again and the preview does continue in our App after collection, too. In this run the native usage gone up to nearly 600MB]
The logcat then throws a lot of something like this:


9 13:21:17.265 1064-18556/? E/mm-camera: <E> 4973: af_lg_pdaf_set_state_start: af_lg_pdaf_set_state_start: START tar_pos = 721, direction = -1, inf_pos = 887, far_end_pos = 902, pd_defocus = 0, fps = 30
05-29 13:21:17.484 514-18576/? E/QCamera: <HAL><E> handleMetadataWithLock: 3179: Cancel missing frame = 7267, buffer = 0xe8e0e9b8,stream type = 5, stream format = 35
05-29 13:21:17.486 514-18578/? E/QCamera: <MCI><E> cancelBuffer: 823: Calling cancel buf on idx:2 for stream type:5
05-29 13:21:17.514 514-18576/? E/QCamera: <HAL><E> handleMetadataWithLock: 3179: Cancel missing frame = 7267, buffer = 0xe8e0e9b8,stream type = 5, stream format = 35
05-29 13:21:17.514 514-18578/? E/QCamera: <MCI><E> cancelBuffer: 823: Calling cancel buf on idx:2 for stream type:5
05-29 13:21:17.536 1064-18556/? E/mm-camera: <E> 4709: af_lg_pdaf_decide_only_coarse_search_stop: af_lg_pdaf_decide_only_coarse_search_stop: ret = 0, cur_real_gain = 4.285354, pos = 843
<E> 4426: af_lg_pdaf_deal_coarse_valid_case: af_lg_pdaf_deal_coarse_valid_case, ** Direction Change!to =583
05-29 13:21:17.550 514-18576/? E/QCamera: <HAL><E> handleMetadataWithLock: 3179: Cancel missing frame = 7267, buffer = 0xe8e0e9b8,stream type = 5, stream format = 35
<HAL><E> handleMetadataWithLock: 3179: Cancel missing frame = 7268, buffer = 0xe8e0edf0,stream type = 5, stream format = 35
05-29 13:21:17.550 514-18578/? E/QCamera: <MCI><E> cancelBuffer: 823: Calling cancel buf on idx:2 for stream type:5
05-29 13:21:17.550 514-18578/? E/QCamera: <MCI><E> cancelBuffer: 823: Calling cancel buf on idx:5 for stream type:5


So it seems like there is some kind of general leakage in Camera2 on Oreo, but the devices and apps seem to handle it differently. But the GC on G6 seems to kick in way to late.


Posted on 29-May-2018
narae0.kim

Re:G6 Android Oreo Camera Memory Leak

Hello,

In this forum, we support developers who are creating mobile apps with LG SDKs.

Therefore, we are limited in providing direct support to you in this case.

For questions about general android app development, please contact android developer site.

Thank you.


Posted on 31-May-2018
jasonsmith

Re:G6 Android Oreo Camera Memory Leak

hey for me it was working smooth on my android phone when it was running on android version 6.0.1 however as I have updated to android version 7.1.1 whenever now I am opening the app it only loads a blank screen on the start up and crashes after a while automatically. How do I fix it?

https://kodi.software/download/ https://messenger.red/ https://hotstar.onl/


Posted on 17-Oct-2018
Navigation