This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

OMX memory leak?

Hello community,

We are using DM8168 with EZSDK 5.04.00.11. Using sys_top we have recently observed a memory leak in the heap of shared region 0 in both HDVICP2 and HDVPSS. After some test and debugging we nailed down the problem to 2 functions: OMX_Init() and OMX_Deinit(), i.e. a trivial piece of code such as:

int main(int argc, char* argv[])
{
   OMX_Init();
   OMX_Deinit();
   return 0;
}

produces 640 bytes leak each time it is executed (please find attached logs before and after executing the above mentioned code 1 and 10 times). Note, that both functions return OMX_ErrorNone.

Our software needs to be restarted (thus consecutive OMX_Init/Deinit) without rebooting the entire board.

Is the a patch or correction available?

LOGS:

before calling the above mentioned code (board freshly rebooted):

sys_top Ver : 0.2.0.0
Number Of Running Cores: 3

DSP    :
Not Running or Do not integrate sys_top functionality

MC.HDVICP2:

Firmware Version: 05_02_00_38
 0 Heap:Size 1048576    Used 171752     MaxU 171752     Free 876824     LarF 876824     
Num SR :4         
SRIn 0 :PhyA 0x9f700000 Virt 0x0        Size 0x200000   
 SRHeap:Size 2095488    Used 26752      MaxU 26752      Free 2068736    LarF 2068736    
SRIn 1 :PhyA 0x9a100000 Virt 0x0        Size 0x100000   
 SRHeap:Size 1048448    Used 0          MaxU 0          Free 1048448    LarF 1048448    
SRIn 2 :PhyA 0xab000000 Virt 0x0        Size 0xbc00000  
 SRHeap:Size 197132160  Used 0          MaxU 0          Free 197132160  LarF 197132160  

MC.HDVPSS:

Firmware Version: 05_02_00_38
 0 Heap:Size 2097152    Used 119888     MaxU 119888     Free 1977264    LarF 1977264    
 1 Heap:Size 28311552   Used 0          MaxU 0          Free 28311552   LarF 28311552   
Num SR :4         
SRIn 0 :PhyA 0x9f700000 Virt 0x0        Size 0x200000   
 SRHeap:Size 2095488    Used 26752      MaxU 26752      Free 2068736    LarF 2068736    
SRIn 1 :PhyA 0x9a100000 Virt 0x0        Size 0x100000   
 SRHeap:Size 1048448    Used 0          MaxU 0          Free 1048448    LarF 1048448    
SRIn 2 :PhyA 0xab000000 Virt 0x0        Size 0xbc00000  
 SRHeap:Size 197132160  Used 0          MaxU 0          Free 197132160  LarF 197132160

After calling the code 1 time --> 640 bytes leak

sys_top Ver : 0.2.0.0
Number Of Running Cores: 3

DSP    :
Not Running or Do not integrate sys_top functionality

MC.HDVICP2:

Firmware Version: 05_02_00_38
 0 Heap:Size 1048576    Used 171752     MaxU 171752     Free 876824     LarF 876824     
Num SR :4         
SRIn 0 :PhyA 0x9f700000 Virt 0x0        Size 0x200000   
 SRHeap:Size 2095488    Used 27392      MaxU 27392      Free 2068096    LarF 2067328    
SRIn 1 :PhyA 0x9a100000 Virt 0x0        Size 0x100000   
 SRHeap:Size 1048448    Used 0          MaxU 0          Free 1048448    LarF 1048448    
SRIn 2 :PhyA 0xab000000 Virt 0x0        Size 0xbc00000  
 SRHeap:Size 197132160  Used 0          MaxU 0          Free 197132160  LarF 197132160  

MC.HDVPSS:

Firmware Version: 05_02_00_38
 0 Heap:Size 2097152    Used 119888     MaxU 119888     Free 1977264    LarF 1977264    
 1 Heap:Size 28311552   Used 0          MaxU 0          Free 28311552   LarF 28311552   
Num SR :4         
SRIn 0 :PhyA 0x9f700000 Virt 0x0        Size 0x200000   
 SRHeap:Size 2095488    Used 27392      MaxU 27392      Free 2068096    LarF 2067328    
SRIn 1 :PhyA 0x9a100000 Virt 0x0        Size 0x100000   
 SRHeap:Size 1048448    Used 0          MaxU 0          Free 1048448    LarF 1048448    
SRIn 2 :PhyA 0xab000000 Virt 0x0        Size 0xbc00000  
 SRHeap:Size 197132160  Used 0          MaxU 0          Free 197132160  LarF 197132160

after executing the code 10 times --> 6400 bytes leak

sys_top Ver : 0.2.0.0
Number Of Running Cores: 3

DSP    :
Not Running or Do not integrate sys_top functionality

MC.HDVICP2:

Firmware Version: 05_02_00_38
 0 Heap:Size 1048576    Used 171752     MaxU 171752     Free 876824     LarF 876824     
Num SR :4         
SRIn 0 :PhyA 0x9f700000 Virt 0x0        Size 0x200000   
 SRHeap:Size 2095488    Used 33152      MaxU 33152      Free 2062336    LarF 2055808    
SRIn 1 :PhyA 0x9a100000 Virt 0x0        Size 0x100000   
 SRHeap:Size 1048448    Used 0          MaxU 0          Free 1048448    LarF 1048448    
SRIn 2 :PhyA 0xab000000 Virt 0x0        Size 0xbc00000  
 SRHeap:Size 197132160  Used 0          MaxU 0          Free 197132160  LarF 197132160  

MC.HDVPSS:

Firmware Version: 05_02_00_38
 0 Heap:Size 2097152    Used 119888     MaxU 119888     Free 1977264    LarF 1977264    
 1 Heap:Size 28311552   Used 0          MaxU 0          Free 28311552   LarF 28311552   
Num SR :4         
SRIn 0 :PhyA 0x9f700000 Virt 0x0        Size 0x200000   
 SRHeap:Size 2095488    Used 33152      MaxU 33152      Free 2062336    LarF 2055808    
SRIn 1 :PhyA 0x9a100000 Virt 0x0        Size 0x100000   
 SRHeap:Size 1048448    Used 0          MaxU 0          Free 1048448    LarF 1048448    
SRIn 2 :PhyA 0xab000000 Virt 0x0        Size 0xbc00000  
 SRHeap:Size 197132160  Used 0          MaxU 0          Free 197132160  LarF 197132160

rg

  • Hi,

    Thanks for reporting the issue, we will look into this issue.

    Regards

    Vimal

  • Vimal,

    This was tracked down to UIA and fixed as SDOCM00093458.

    There is a memory leak in UIA 1.00.03.25 as integrated into EZSDK 5.04.

    This is in file ti/uia/linux/ServiceMgr.c The function ServiceMgr_allocate() calls ServiceMgr_prime() to allocate the memory for messages. The problem is that ServiceMgr_prime() is called with a size of ServiceMgr_config.maxCtrlPacketSize which is 128 bytes. In ServiceMgr_prime() the size is incremented by sizeof(MessageQ_MsgHeader) which is 32, leading to a Memory_alloc() call of size 160 bytes. However, the cleanup routine ServiceMgr_cleanupResources() makes direct calls to Memory_free of size ServiceMgr_config.maxCtrlPacketSize which is 128 bytes only. As the sizes are mismatch it leads to the memory not being freed and so there's a leak.

    So, solution is to increase size of the Memory_free to (ServiceMgr_config.maxCtrlPacketSize + sizeof(MessageQ_MsgHeader) )

     

    Iain

  • Iain,

    Yes, I had reported this to UIA team, and they promised to fix it in next release. 

    Thanks

    Vimal

  • Hi , 

    UIA memory leak issue is fixed in 5514.

    Regards

    Vimal