简体   繁体   中英

numa_alloc_onnode() allocates memory more then it can?

I tried to use numa_alloc_onnode() to allocate 40GB of memory on a 32GB node by running the below code. However it does not report any errors.

a = (int *) numa_alloc_local (sizeof(int) * GB_8 * 5);
if (a == NULL)
    printf("a error\n");
for ( i = 0; i <GB_8*5; i++ )
    a[i] = (int)i;
printf("a done\n");

This is the specification of my machine. http://i.stack.imgur.com/bM2Gr.png

Can anyone please help explain?

Until you actually try to STORE something in that memory, it's just vapor, imaginary... virtual even!

The system will say, SURE! you can have that much in your name... but it's all just 'on paper' until you use it.

If you were to try to store something in all that 40+GB of memory, then you'd most likely encounter errors... depends on the size of your swap space at that point.

The first three Google hits for overcommit :

https://www.kernel.org/doc/Documentation/vm/overcommit-accounting http://www.win.tue.nl/~aeb/linux/lk/lk-9.html http://searchservervirtualization.techtarget.com/definition/memory-overcommit

Just remember that until you store something there, it's all imaginary anyways.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM