iMX6 GStreamer Memory Leak

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iMX6 GStreamer Memory Leak

Jump to solution
2,469 Views
grim
Contributor III

I've been trying to track down a memory leak in our system.

We have an iMX6 solo (512MB of RAM) that's intended to play video clips when the system is in "Idle" mode (not being used by a customer). We're currently playing a small video in a loop (.mov, less than 1MB in size, plays for less than 10 seconds) after a period of time when there is no touchscreen activity detected.

We're currently using Qt 5.5 (Enterprise) for our user interface as well as handling multimedia.

We noticed that if we let our video loop continuously for extended periods of time (> 24 hours) that, eventually, our system will crash because the 'OOM' kicks in and reports that there is not enough system memory.... it kills our application.

I decided to start a thread in our system that goes out (about once every 5 seconds) and captures all the information stored in '/proc/meminfo'. I could see that the memory was slowly leaking away over time. I could also see that "Commited_AS" continued to grow over time.

After combing through the community, I found several helpful suggestions but nothing that eliminates this memory leak.

One thing I have implemented in our system, as recommended within the community, is a thread that runs in the background that writes a "3" to '/proc/sys/vm/drop_caches'. This really only helped to prolong the inevitable. The system memory still appears to leak away but at a much lower rate.

I imported my log file, graphed the free memory and captured it to share. Around the '33526' mark in this graph, the 'OOM' kicked in and killed our application. I thought this seemed strange until I saw how high 'Commited_AS' had climbed.

Qt_55_Small_Movie_memfree.jpg

Qt_55_Small_Movie_committed_as.jpg

Can anybody offer any advice on what I can change in the system to eliminate this memory leak error?

Any advice would be greatly appreciated.

Labels (3)
0 Kudos
1 Solution
1,173 Views
grim
Contributor III

Yuri,

Thanks for your attention to this.

It turns out that the problem resides within the BSP that our vendor was providing.

We've been doing testing with Freescale's latest BSP and are seeing MUCH better results now.

We're going to work with the vendor to integrate the "latest and greatest" BSP.

Thank you again.

-Bob

View solution in original post

0 Kudos
6 Replies
1,174 Views
grim
Contributor III

Yuri,

Thanks for your attention to this.

It turns out that the problem resides within the BSP that our vendor was providing.

We've been doing testing with Freescale's latest BSP and are seeing MUCH better results now.

We're going to work with the vendor to integrate the "latest and greatest" BSP.

Thank you again.

-Bob

0 Kudos
1,173 Views
grim
Contributor III

Thank you Yuri.

I will investigate this.

0 Kudos
1,173 Views
Yuri
NXP Employee
NXP Employee

Hello,

When playing the video for a long time, allocation of contiguous memory may fail

(memory fragmentation).

   To play video when the system memory is low, run the command:

$ echo 1 >/proc/sys/vm/lowmem_reserve_ratio

   It protects the DMA zone and avoids memory allocation errors.

Also, from the next thread :

"[i.MX6]memory leak of Gstreamer"

https://community.freescale.com/thread/333860

"... we try to perform

$ echo 1 >/proc/sys/vm/drop_caches

by the script of while [1] in playing video. The memory will not rise continuously

and can play video normally."


Have a great day,
Yuri

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
1,173 Views
grim
Contributor III

I'm seeing the same results.

Ran the test for just under 24 hours and lost about 50MB of RAM.

M821_Qt_55_video.jpg

I know I'm not the only person who's ran into this problem.

Does anybody have a solution?

0 Kudos
1,173 Views
Yuri
NXP Employee
NXP Employee

There are tools for avoiding file caching of a specific application like the

pagecache-management (https://code.google.com/p/pagecache-mangagement/)

This is an open source project NOT maintained and NOT supported by Freescale,

which could anyway help in the intent.

Regards,

Yuri.

0 Kudos
1,173 Views
grim
Contributor III

Yuri,

Thank you for your reply.

I will modify my test code to accommodate your suggestions, test it and post a follow-up.

0 Kudos