memory leak 美颜算法释放时机错误, 导致 Native 部分资源未释放

 

现象步骤: 内存泄漏, 

从给的操作视频 提取主要点, 分为阶段测试

 1.提取步骤,单独测试

    (1)拍照,  back

    (2)拍照,home

    (3)切换模式 , back

      (4) 进入 camera,back

      (5) 进入 camera,home   

      等等...

     发现问题点在 进入(5) camera, home  测试后, 每次native 的的占用都会增加, 且无回落。

 

2. 分析脚本(自动进入 home)抓取的  memory info.

 可看到明显的  Native Heap增加, Graphics项 明显的增加

 

** MEMINFO in pid 12056 [com..camera] **
                   Pss  Private  Private  SwapPss     Heap     Heap     Heap
                 Total    Dirty    Clean    Dirty     Size    Alloc     Free
                ------   ------   ------   ------   ------   ------   ------
  Native Heap    45868    45144      700    23381    79016    62452    16563
  Dalvik Heap    43074    43032       28       57    21443    16083     5360
  ...
        TOTAL   162844   122116     9304    25743   100459    78535    21923
 
 App Summary
                       Pss(KB)
                        ------
           Java Heap:    45096
         Native Heap:    45144
                Code:     8260
               Stack:       36
            Graphics:    28672
       Private Other:     4212
              System:    31424
 
               TOTAL:   162844       TOTAL SWAP PSS:    25743


** MEMINFO in pid 12056 [com..camera] **
                   Pss  Private  Private  SwapPss     Heap     Heap     Heap
                 Total    Dirty    Clean    Dirty     Size    Alloc     Free
                ------   ------   ------   ------   ------   ------   ------
  Native Heap    45468    44772      672    22269    76724    63081    13642
  Dalvik Heap    32608    31720      792       16    21450    16088     5362
  ...
        TOTAL   160868   120424    10172    24506    98174    79169    19004
 
 App Summary
                       Pss(KB)
                        ------
           Java Heap:    33784
         Native Heap:    44772
                Code:     8392
               Stack:       36
            Graphics:    38588
       Private Other:     5024
              System:    30272

               TOTAL:   160868       TOTAL SWAP PSS:    24506
 
 

** MEMINFO in pid 12056 [com..camera] **
                   Pss  Private  Private  SwapPss     Heap     Heap     Heap
                 Total    Dirty    Clean    Dirty     Size    Alloc     Free
                ------   ------   ------   ------   ------   ------   ------
  Native Heap    47984    47336      624    21977    79624    64317    15306
  Dalvik Heap    24568    23680      792       16    21456    16092     5364
  ...
        TOTAL   159029   118908    10144    24198   101080    80409    20670
 
 App Summary
                       Pss(KB)
                        ------
           Java Heap:    25744
         Native Heap:    47336
                Code:     8416
               Stack:       36
            Graphics:    42492
       Private Other:     5028
              System:    29977
 
               TOTAL:   159029       TOTAL SWAP PSS:    24198

 

    

     

你可能感兴趣的:(android,memory)