<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: i.MX6 Memory issues after long encoding in i.MX Processors</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/i-MX6-Memory-issues-after-long-encoding/m-p/738418#M114932</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am recording not playing back though so i am not using playbin or multiqueue.&amp;nbsp; Also the issue happens if i record many short videos instead of just 1 long as well.&amp;nbsp; It's like there is some sort of memory leak, after recording so much it just runs out of memory.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 10 May 2018 15:19:12 GMT</pubDate>
    <dc:creator>jcc273</dc:creator>
    <dc:date>2018-05-10T15:19:12Z</dc:date>
    <item>
      <title>i.MX6 Memory issues after long encoding</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX6-Memory-issues-after-long-encoding/m-p/738416#M114930</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;So i have a recording device using an i.MX 6 Solo and it encodes to h264 video.&amp;nbsp; The problem is that after i record for awhile i cannot start a new recording because I get memory errors.&amp;nbsp; For example if i record for 25 minutes straight i have no issues during the recording but as soon as that recording is stopped i cannot start another one without getting a memory crash:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;cam-source:src: page allocation failure: order:9, mode:0xd1&lt;BR /&gt;CPU: 0 PID: 16107 Comm: cam-source:src Not tainted 4.1.15-0.3-224221-g6bef30f-dirty #29&lt;BR /&gt;Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)&lt;BR /&gt;[&amp;lt;80015904&amp;gt;] (unwind_backtrace) from [&amp;lt;80011b7c&amp;gt;] (show_stack+0x10/0x14)&lt;BR /&gt;[&amp;lt;80011b7c&amp;gt;] (show_stack) from [&amp;lt;80658220&amp;gt;] (dump_stack+0x6c/0xb4)&lt;BR /&gt;[&amp;lt;80658220&amp;gt;] (dump_stack) from [&amp;lt;800a26b0&amp;gt;] (warn_alloc_failed+0xe8/0x114)&lt;BR /&gt;[&amp;lt;800a26b0&amp;gt;] (warn_alloc_failed) from [&amp;lt;800a4f44&amp;gt;] (__alloc_pages_nodemask+0x5fc/0x788)&lt;BR /&gt;[&amp;lt;800a4f44&amp;gt;] (__alloc_pages_nodemask) from [&amp;lt;8001a16c&amp;gt;] (__dma_alloc_buffer+0x2c/0x168)&lt;BR /&gt;[&amp;lt;8001a16c&amp;gt;] (__dma_alloc_buffer) from [&amp;lt;8001a444&amp;gt;] (__dma_alloc+0x19c/0x258)&lt;BR /&gt;[&amp;lt;8001a444&amp;gt;] (__dma_alloc) from [&amp;lt;8001a620&amp;gt;] (arm_dma_alloc+0x84/0x90)&lt;BR /&gt;[&amp;lt;8001a620&amp;gt;] (arm_dma_alloc) from [&amp;lt;8046a8bc&amp;gt;] (mxc_v4l_do_ioctl+0x132c/0x1bc4)&lt;BR /&gt;[&amp;lt;8046a8bc&amp;gt;] (mxc_v4l_do_ioctl) from [&amp;lt;80451da4&amp;gt;] (video_usercopy+0x230/0x3f4)&lt;BR /&gt;[&amp;lt;80451da4&amp;gt;] (video_usercopy) from [&amp;lt;8044d51c&amp;gt;] (v4l2_ioctl+0x5c/0x114)&lt;BR /&gt;[&amp;lt;8044d51c&amp;gt;] (v4l2_ioctl) from [&amp;lt;800e3e30&amp;gt;] (do_vfs_ioctl+0x4ec/0x5b0)&lt;BR /&gt;[&amp;lt;800e3e30&amp;gt;] (do_vfs_ioctl) from [&amp;lt;800e3f28&amp;gt;] (SyS_ioctl+0x34/0x5c)&lt;BR /&gt;[&amp;lt;800e3f28&amp;gt;] (SyS_ioctl) from [&amp;lt;8000eb40&amp;gt;] (ret_fast_syscall+0x0/0x3c)&lt;BR /&gt;Mem-Info:&lt;BR /&gt;active_anon:1399 inactive_anon:19380 isolated_anon:0&lt;BR /&gt; active_file:3833 inactive_file:12905 isolated_file:0&lt;BR /&gt; unevictable:1 dirty:1 writeback:0 unstable:0&lt;BR /&gt; slab_reclaimable:549 slab_unreclaimable:907&lt;BR /&gt; mapped:2149 shmem:19390 pagetables:70 bounce:0&lt;BR /&gt; free:2857 free_pcp:76 free_cma:0&lt;BR /&gt;Normal free:11428kB min:1704kB low:2128kB high:2556kB active_anon:5596kB inactive_anon:77520kB active_file:15332kB inactive_file:51620kB unevictable:4kB isolated(anon):0kB isolated(file):0kB present:524288kB managed:182068kB mlocked:4kB dirty:4kB writeback:0kB mapped:8596kB shmem:77560kB slab_reclaimable:2196kB slab_unreclaimable:3628kB kernel_stack:584kB pagetables:280kB unstable:0kB bounce:0kB free_pcp:304kB local_pcp:304kB free_cma:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no&lt;BR /&gt;lowmem_reserve[]: 0 0 0&lt;BR /&gt;Normal: 335*4kB (MR) 225*8kB (UMR) 118*16kB (UMR) 56*32kB (U) 28*64kB (U) 8*128kB (UMR) 1*256kB (R) 1*512kB (R) 1*1024kB (R) 0*2048kB 0*4096kB 0*8192kB 0*16384kB 0*32768kB = 11428kB&lt;BR /&gt;36127 total pagecache pages&lt;BR /&gt;0 pages in swap cache&lt;BR /&gt;Swap cache stats: add 0, delete 0, find 0/0&lt;BR /&gt;Free swap = 0kB&lt;BR /&gt;Total swap = 0kB&lt;BR /&gt;131072 pages RAM&lt;BR /&gt;0 pages HighMem/MovableOnly&lt;BR /&gt;85555 pages reserved&lt;BR /&gt;0 pages cma reserved&lt;BR /&gt;ERROR: v4l2 capture: mxc_allocate_frame_buf failed.&lt;BR /&gt;GST Error: Internal data flow error.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I added this call after the end of every recording:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;echo 3 | tee /proc/sys/vm/drop_caches&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And it helped immensely because before that it would happen even after a couple short recordings, so now it takes longer to get the issues but it still happens : /.&amp;nbsp; It is like the encoder is&amp;nbsp;has a leak and is slowly taking all the CMA memory and then eventually I don't have a enough left to start a new recording process!&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am running the rel_imx_4.1.15_1.1.0_ga kernel.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 May 2018 22:53:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX6-Memory-issues-after-long-encoding/m-p/738416#M114930</guid>
      <dc:creator>jcc273</dc:creator>
      <dc:date>2018-05-09T22:53:42Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX6 Memory issues after long encoding</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX6-Memory-issues-after-long-encoding/m-p/738417#M114931</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jarrod&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;possible issues with long videos are described in attached Release Notes&lt;/P&gt;&lt;P&gt;sect.6.6 Known issues and limitations for multimedia:&lt;/P&gt;&lt;P&gt;As the maximum buffer size of the playbin multi-queue is 2 MB, problems may be&lt;/P&gt;&lt;P&gt;seen with some long audio or video interleaved streams. You can enlarge this buffer&lt;/P&gt;&lt;P&gt;size to support these special use cases.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards&lt;BR /&gt;igor&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 May 2018 08:41:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX6-Memory-issues-after-long-encoding/m-p/738417#M114931</guid>
      <dc:creator>igorpadykov</dc:creator>
      <dc:date>2018-05-10T08:41:12Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX6 Memory issues after long encoding</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX6-Memory-issues-after-long-encoding/m-p/738418#M114932</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am recording not playing back though so i am not using playbin or multiqueue.&amp;nbsp; Also the issue happens if i record many short videos instead of just 1 long as well.&amp;nbsp; It's like there is some sort of memory leak, after recording so much it just runs out of memory.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 May 2018 15:19:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX6-Memory-issues-after-long-encoding/m-p/738418#M114932</guid>
      <dc:creator>jcc273</dc:creator>
      <dc:date>2018-05-10T15:19:12Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX6 Memory issues after long encoding</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX6-Memory-issues-after-long-encoding/m-p/738419#M114933</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;please try to reproduce issue of SabreSD reference board with Demo Images:&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://www.nxp.com/webapp/Download?colCode=L4.1.15_2.0.0_iMX7D&amp;amp;appType=license&amp;amp;location=null&amp;amp;Parent_nodeId=1337699481071706174845&amp;amp;Parent_pageType=product" title="https://www.nxp.com/webapp/Download?colCode=L4.1.15_2.0.0_iMX7D&amp;amp;appType=license&amp;amp;location=null&amp;amp;Parent_nodeId=1337699481071706174845&amp;amp;Parent_pageType=product"&gt;https://www.nxp.com/webapp/Download?colCode=L4.1.15_2.0.0_iMX7D&amp;amp;appType=license&amp;amp;location=null&amp;amp;Parent_nodeId=133769948107…&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;also one can use dropping disc caches during video playback via VPU with a small perl script, as described on post [May 22, 2014 12:46 PM]&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.nxp.com/thread/323018"&gt;https://community.nxp.com/thread/323018&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 May 2018 06:58:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX6-Memory-issues-after-long-encoding/m-p/738419#M114933</guid>
      <dc:creator>igorpadykov</dc:creator>
      <dc:date>2018-05-11T06:58:33Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX6 Memory issues after long encoding</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX6-Memory-issues-after-long-encoding/m-p/738420#M114934</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I do not have a SabreSD board, i have a compulab board and and econ systems board but I'm guessing those won't help you here?&amp;nbsp; I am already dropping disk caches during recording every few seconds and after the recording ends. still crashes.&amp;nbsp; Doesn't seem to be related to the encoder though.&amp;nbsp; I was able to create a simple pipeline that does it:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;gst-launch-1.0 -e imxv4l2videosrc ! avimux ! filesink location=/home/root/tempTest.avi&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Letting this run for a few minutes (creates a 2GB AVI file) and then stopping i get the issue described where i cannot start another recording without restarting because it can't get memory.&amp;nbsp; So it's like the actual videosrc buffer memory is not getting released???&amp;nbsp; Its weird because it doesn't run out of memory during recording, i can record for as long as i want with no issues but after recording for several minutes worth of time and then stopping i cannot start another recording : /&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 May 2018 16:07:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX6-Memory-issues-after-long-encoding/m-p/738420#M114934</guid>
      <dc:creator>jcc273</dc:creator>
      <dc:date>2018-05-11T16:07:22Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX6 Memory issues after long encoding</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX6-Memory-issues-after-long-encoding/m-p/738421#M114935</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;support policy for non-nxp boards is described on link&lt;BR /&gt;&lt;A class="link-titled" href="http://freescale.github.io/doc/release-notes/2.3/" title="http://freescale.github.io/doc/release-notes/2.3/"&gt;FSL Community BSP Release Notes 2.3 documentation&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;"..every new board must have someone assigned as maintainer..&lt;BR /&gt;The maintainer duties:&lt;BR /&gt;Responsible to keep that machine working (that means, booting and with some stability) &lt;BR /&gt;Keep kernel, u-boot updated/tested/working.&lt;BR /&gt;Keep release notes updated&lt;BR /&gt;Keep test cycle updated.."&lt;BR /&gt;So for issues with compulab board and and econ systems boards software one can apply&lt;BR /&gt;to vendor of these boards.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards&lt;BR /&gt;igor&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 13 May 2018 23:32:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX6-Memory-issues-after-long-encoding/m-p/738421#M114935</guid>
      <dc:creator>igorpadykov</dc:creator>
      <dc:date>2018-05-13T23:32:08Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX6 Memory issues after long encoding</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX6-Memory-issues-after-long-encoding/m-p/738422#M114936</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Figured this out.&amp;nbsp; So the main problem was that CMA was not properly enabled in the kernel config.&amp;nbsp; CMA itself was all enabled but the option CONFIG_DMA_CMA was set to no.&amp;nbsp; Because of this the kernel was just ignoring the &amp;gt;256MB i had assigned as reserved cma memory.&amp;nbsp; This means not only was the system not using cma for the capture stuff but that it was also working on half the memory.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So after running a recording for awhile all the memory allocation from file system writes would fragment the memory so badly that on a second recording it could not find space for all 6 of the almost 2MB continuous buffers it needed and it would fail. Even calling drop_caches would only help for a short while.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I correctly enabled CMA to allow for the continuous memory to be available and that fixed it.&amp;nbsp; For good measure I also went ahead and modified mxc_v4l2_capture.c to not release the buffers once allocated.&amp;nbsp; So on first run it allocates buffers then keeps them until removal of the driver (never) or if a bigger size is needed because pix.sizeimage changes it will release and reallocate as well.&amp;nbsp; This is much the way that the mxc_vpu works as well.&amp;nbsp; I figured it didn't make sense to ever release since this is a recording device and i will just be almost constantly using them.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 May 2018 19:05:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX6-Memory-issues-after-long-encoding/m-p/738422#M114936</guid>
      <dc:creator>jcc273</dc:creator>
      <dc:date>2018-05-18T19:05:08Z</dc:date>
    </item>
  </channel>
</rss>

