Quoth An N. Ho:
> I think free memory is 10400kb= 10.15M. But when I use simple code to
test:
>       
>                   While((mem=calloc(1,1024*1024))==NULL)
>                   {
>                               i++;
>                               printf(“Number of calloc %d\n”,i);
>       }
>            
> The result:
>                         root:/mnt> root:/mnt> ./test1
>       size of mem=1
>       size of mem=2
>       size of mem=3 
>       size of mem=4
>       oom-killer: gfp_mask=0x40d0, order=9

Your output doesn't match your posted source code, first of all.

>       Normal free:3040kB min:512kB low:2176kB high:2304kB active:368kB
inactive:304kB 
>       present:16384kB pages_scanned:805 all_unreclaimable? yes

This means that there was just under 3MB free when the crash occurred, so
you obviously got somewhere.

>       Normal: 6*4kB 13*8kB 6*16kB 4*32kB 4*64kB 1*128kB 1*256kB 0*512kB
0*1024kB 
>       1*2048kB 0*4096kB = 3040kB

This means that your largest single block was 2MB, and your next largest was
256KB.

Trying to allocate a further 1MB must therefore split the 2MB block in half
(since there's no VMM it's not possible to stitch smaller blocks together).

In any case, allocating 1024KB from the 3040KB free would leave 2016KB.  If
you look back at the line that starts "Normal free" you'll see that this is
below both the high-water and low-water marks ("high" and "low").  I forget
which one it uses, but once free memory falls below one of those then it
starts looking for processes to kill to free up some memory.  It's sort of
like a reserve space.

The amount of actual memory this consists of depends on the amount of RAM
installed and the amount of RAM per page.



_______________________________________________
uClinux-dev mailing list
[email protected]
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by [email protected]
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev

Reply via email to