<?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 L5.4.70 imx8mq-evk memory malloc size in i.MX Processors</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/L5-4-70-imx8mq-evk-memory-malloc-size/m-p/1294360#M175681</link>
    <description>&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;Is it any malloc problem with&amp;nbsp; L5.4.70-2.3.0 SDK?&lt;/P&gt;&lt;P&gt;I am runing L5.4.70-2.3.0_images_MX8MQEVK.zip program on imx8mq-evk development board.&lt;/P&gt;&lt;P&gt;After enter file system, I can get total and free memory size by free command.&lt;/P&gt;&lt;P&gt;when I try to use malloc to get the maximum memory,the maxinum memory is bigger then system free memory size.&lt;/P&gt;&lt;P&gt;It also has the probem on the LF_v5.4.y-1.0.0_images_MX8MQEVK.zip.But it does not appear on the L4.14.98_2.0.0_ga_images_MX8MQEVK.zip version.&lt;/P&gt;&lt;P&gt;How can i fix this problem?&lt;/P&gt;&lt;P&gt;as the picture shows：&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="WuKT_0-1623980301808.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/147384i837B25B97D114D89/image-size/medium?v=v2&amp;amp;px=400" role="button" title="WuKT_0-1623980301808.png" alt="WuKT_0-1623980301808.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;mem_tests code:&lt;/P&gt;&lt;P&gt;#include&amp;lt;stdio.h&amp;gt;&lt;BR /&gt;#include&amp;lt;stdlib.h&amp;gt;&lt;BR /&gt;size_t maximum=0;&lt;BR /&gt;int main(int argc,char *argv[])&lt;BR /&gt;{&lt;BR /&gt;void * block;&lt;BR /&gt;void * tmpblock;&lt;BR /&gt;size_t blocksize[]={1024*1024, 1024, 1};&lt;BR /&gt;int i,count;&lt;BR /&gt;for(i=0;i&amp;lt;3;i++){&lt;BR /&gt;for(count=1;;count++){&lt;BR /&gt;block = malloc(maximum+blocksize[i]*count);&lt;BR /&gt;if(block){&lt;BR /&gt;tmpblock = block;&lt;BR /&gt;maximum += blocksize[i]*count;&lt;BR /&gt;free(block);&lt;BR /&gt;}else{&lt;BR /&gt;break;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;printf("maximum malloc size = %lf GB\n",maximum*1.0 / 1024.0 / 1024.0 / 1024.0);&lt;BR /&gt;printf("the address is %x\n",tmpblock);&lt;BR /&gt;printf("the address end is %x\n", tmpblock + maximum);&lt;BR /&gt;}&lt;/P&gt;</description>
    <pubDate>Fri, 18 Jun 2021 02:17:26 GMT</pubDate>
    <dc:creator>Wu-KT</dc:creator>
    <dc:date>2021-06-18T02:17:26Z</dc:date>
    <item>
      <title>L5.4.70 imx8mq-evk memory malloc size</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/L5-4-70-imx8mq-evk-memory-malloc-size/m-p/1294360#M175681</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;Is it any malloc problem with&amp;nbsp; L5.4.70-2.3.0 SDK?&lt;/P&gt;&lt;P&gt;I am runing L5.4.70-2.3.0_images_MX8MQEVK.zip program on imx8mq-evk development board.&lt;/P&gt;&lt;P&gt;After enter file system, I can get total and free memory size by free command.&lt;/P&gt;&lt;P&gt;when I try to use malloc to get the maximum memory,the maxinum memory is bigger then system free memory size.&lt;/P&gt;&lt;P&gt;It also has the probem on the LF_v5.4.y-1.0.0_images_MX8MQEVK.zip.But it does not appear on the L4.14.98_2.0.0_ga_images_MX8MQEVK.zip version.&lt;/P&gt;&lt;P&gt;How can i fix this problem?&lt;/P&gt;&lt;P&gt;as the picture shows：&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="WuKT_0-1623980301808.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/147384i837B25B97D114D89/image-size/medium?v=v2&amp;amp;px=400" role="button" title="WuKT_0-1623980301808.png" alt="WuKT_0-1623980301808.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;mem_tests code:&lt;/P&gt;&lt;P&gt;#include&amp;lt;stdio.h&amp;gt;&lt;BR /&gt;#include&amp;lt;stdlib.h&amp;gt;&lt;BR /&gt;size_t maximum=0;&lt;BR /&gt;int main(int argc,char *argv[])&lt;BR /&gt;{&lt;BR /&gt;void * block;&lt;BR /&gt;void * tmpblock;&lt;BR /&gt;size_t blocksize[]={1024*1024, 1024, 1};&lt;BR /&gt;int i,count;&lt;BR /&gt;for(i=0;i&amp;lt;3;i++){&lt;BR /&gt;for(count=1;;count++){&lt;BR /&gt;block = malloc(maximum+blocksize[i]*count);&lt;BR /&gt;if(block){&lt;BR /&gt;tmpblock = block;&lt;BR /&gt;maximum += blocksize[i]*count;&lt;BR /&gt;free(block);&lt;BR /&gt;}else{&lt;BR /&gt;break;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;printf("maximum malloc size = %lf GB\n",maximum*1.0 / 1024.0 / 1024.0 / 1024.0);&lt;BR /&gt;printf("the address is %x\n",tmpblock);&lt;BR /&gt;printf("the address end is %x\n", tmpblock + maximum);&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jun 2021 02:17:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/L5-4-70-imx8mq-evk-memory-malloc-size/m-p/1294360#M175681</guid>
      <dc:creator>Wu-KT</dc:creator>
      <dc:date>2021-06-18T02:17:26Z</dc:date>
    </item>
    <item>
      <title>Re: L5.4.70 imx8mq-evk memory malloc size</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/L5-4-70-imx8mq-evk-memory-malloc-size/m-p/1294596#M175704</link>
      <description>&lt;P&gt;I have found the reason:&lt;/P&gt;&lt;P&gt;&lt;A href="https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/mm/util.c?h=linux-5.2.y&amp;amp;id=8c7829b04c523cdc732cb77f59f03320e09f3386" target="_blank"&gt;https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/mm/util.c?h=linux-5.2.y&amp;amp;id=8c7829b04c523cdc732cb77f59f03320e09f3386&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jun 2021 09:26:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/L5-4-70-imx8mq-evk-memory-malloc-size/m-p/1294596#M175704</guid>
      <dc:creator>Wu-KT</dc:creator>
      <dc:date>2021-06-18T09:26:34Z</dc:date>
    </item>
  </channel>
</rss>

