I use a test to test memory allocate in hikey board:
#include <stdio.h>
#include <stdlib.h>
#define MEGABYTE 1024*1024
int main(int argc, char *argv[])
{
void *myblock = NULL;
int count = 0;
while (1)
{
myblock = (void *) calloc(1,MEGABYTE);
if (!myblock) break;
printf("Currently allocating %d MB\n", ++count);
}
exit(0);
}
and I also disable the oom-killer by using echo 2 > /proc/sys/vm//proc/sys/vm/overcommit_memory
then I find it can only allocate the about 240M:
Currently allocating 239 MB Currently allocating 240 MB root@linaro-alip:/home/linaro/test#while the hikey have nearly 900M memory:
root@linaro-alip:/home/linaro/test# free -h total used free shared buffers cached Mem: 894M 125M 769M 5.2M 4.7M 31M -/+ buffers/cache: 89M 805M Swap: 0B 0B 0B
so anyone know the reason? I use 4.1+hikey+debian,thanks