#include <stdio.h>
#include <stdlib.h>
main()
{
int MB = 0;
while(malloc(1<<20)) ++MB;
printf("Allocated %d MB total \n", MB);
return 0;
}
#include <stdlib.h>
main()
{
int MB = 0;
while(malloc(1<<20)) ++MB;
printf("Allocated %d MB total \n", MB);
return 0;
}
总分配的内存量取决于交换区和你的系统配置中的进程限制

浙公网安备 33010602011771号