AM5728: Memory leak issue with omap buffer object

Part Number: AM5728

Hi,

We are using Processor SDK 3.3 () on AM5728 EVM Board .

We have written custom encode application with reference of  videenc2 test app). We are observing Memory leak issue with that. Below is sequence of API usage.

Allocation and Map:

omap_bo_new : Buffer allocation

omap_bo_map: Map to process address space

omap_bo_dmabuf: get dmabuf fd to share with remoteproc

dce_buf_lock: reserve buffer Mmrpc_Use

De-allocation and Free:

dce_buf_unlock: Mmrpc_release

close: FD given by omap_bo_dmabuf

omap_bo_del: delete buffer object

But it seems these buffers are not being freed even after process exit. Please let us know if any step is missed in buffer free.

This issue can easily be reproduced with Gstreamer pipeline also.

#!/bin/bash
a=0

while [ $a -lt 50000 ]

do
           for filename in *.264; do
                   gst-launch-1.0 filesrc location="$filename" ! decodebin ! fakesink
           done
           a=`expr $a + 1`
done

"free" command is used for memory statistics.

On board Boot:

root@am57xx-evm:~#
root@am57xx-evm:~# free
total used free shared buff/cache available
Mem: 1868348 153452 1511280 28844 203616 1657036
Swap: 0 0 0

After multiple G-streamer iteration

root@am57xx-evm:~#
root@am57xx-evm:~# free
total used free shared buff/cache available
Mem: 1868348 155128 63060 28868 1650160 1655144
Swap: 0 0 0
root@am57xx-evm:~#

This doesn't seem to be application specific virtual memory leak issue, As linux frees all malloced memory at process exit. The memory statistics are checked after process exit with free command. This issue looks like related to omap_bo APIs or it's usage. Let us know if there's a way to figure out which driver is using this memory / getting more information.

Please let us know if more/ specific information is needed.