当前位置:网站首页>Analysis of camera memory memory leakage (II)

Analysis of camera memory memory leakage (II)

2022-06-26 03:46:00 Cmatrix204

         adopt Provider Yes com.android.camera2 Conduct memory Monitoring is only equivalent to monitoring a process memory info Information monitoring , When a real memory leak occurs , A separate check camera.android.camera2 A single package is certainly not complete check Problem point , Can pass sysinfo The corresponding /proc/meminfo In the message MemAvailable The displayed size is used to view the macro usage , Then the process of doubt is passed dumpsys meminfo The way to check Specific skeptical processes , Now in order to Camera Module as an example .

One 、sysinfo The information determines the problem time node

         Every time 2min Printing system meminfo Of sysinfo log, Before and after the time node when the relevant problem occurs, you can go through sysinfo The approximate time point of meminfo Is there a problem with the status of .

Specific tracking log as follows : 

        Let's see if there is crash And so on camera Crumble log produce

         analysis sysinfo dependent memAvailable, Every time 2min Within 200M Left and right memory Information fluctuation , In a 2min Within the band of 800M Memory fluctuations , The abnormal occurrence here will lead to camera crash And other related information to release the occupied memory, resulting in large memory fluctuations .

        22:52:25-22:54:26 Analyze other main log Corresponding node discovery com.android.camera OOM abnormal ( It's like reporting an error :lowmemory) Error message .

Two 、 adopt dumpsys meminfo Memory occupation of pressure measurement and positioning related processes

        Yes camera Related to each process memory Monitor and handle the usage .                  1.

        1. Through the command dump camera Application layer related memory

        adb shell "dumpsys meminfo com.android.camera2 | awk '/Graphics|Java Heap:|Native Heap:|TOTAL PSS/' " >>meminfo.txt

        2. Through the command dump camera HAL/FrameWork Layer dependent memory Information

        adb shell ps -A | grep camera

        see camera HAL Related memory information

        adb shell "dumpsys meminfo 504" >> meminfo_cameraprovider.txt 

 

 

        see camera FrameWork Layer related memory information
        adb shell "dumpsys meminfo 726" >> meminfo_cameraserver.txt

 

 

        Finally, for each test memory Total Pss Information for statistics , Draw as a related process and take continuous photos memory Relevant charts can be used to visually observe the relevant memory consumption , The view is as follows :

        

      

 

Exhibition information platform Camera The related process

MTK platform  Camera The related process

summary  

        Memory related exceptions are certainly not as easy to handle as other problems , Repeated pressure test is required , Identify specific outliers , Even need to borrow addr2line -e -f Parse dynamic link library , Locate the function interface corresponding to the stack address when the exception occurs ;objdump -S -D Disassembly related lib, Identify specific problem points ; Finally, if you can locate a specific memory application point , It will be much better to solve it .

原网站

版权声明
本文为[Cmatrix204]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/177/202206260319406957.html