L5.4.70 imx8mq-evk memory malloc size

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

L5.4.70 imx8mq-evk memory malloc size

Jump to solution
603 Views
Wu-KT
Contributor I

Hi:

Is it any malloc problem with  L5.4.70-2.3.0 SDK?

I am runing L5.4.70-2.3.0_images_MX8MQEVK.zip program on imx8mq-evk development board.

After enter file system, I can get total and free memory size by free command.

when I try to use malloc to get the maximum memory,the maxinum memory is bigger then system free memory size.

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.

How can i fix this problem?

as the picture shows:

WuKT_0-1623980301808.png

mem_tests code:

#include<stdio.h>
#include<stdlib.h>
size_t maximum=0;
int main(int argc,char *argv[])
{
void * block;
void * tmpblock;
size_t blocksize[]={1024*1024, 1024, 1};
int i,count;
for(i=0;i<3;i++){
for(count=1;;count++){
block = malloc(maximum+blocksize[i]*count);
if(block){
tmpblock = block;
maximum += blocksize[i]*count;
free(block);
}else{
break;
}
}
}
printf("maximum malloc size = %lf GB\n",maximum*1.0 / 1024.0 / 1024.0 / 1024.0);
printf("the address is %x\n",tmpblock);
printf("the address end is %x\n", tmpblock + maximum);
}

Labels (2)
Tags (1)
0 Kudos
1 Solution
1 Reply