Blog

测试vps最大使用内存

关闭SWAP sudo swapoff -a (openvz貌似无效)
开启SWAP sudo swapon -a
echo “#include <stdlib.h>” > test.c
echo ‘void main(){ int z;for (z=0;z<16384;z++){ void *t=malloc(1048576);memset(t,1,1048576); printf(“Allocated: %dM\n”, z);} int i ; scanf(“%d\n”,&i); }’ >> test.c
gcc test.c && ./a.out

没有评论

Leave a Reply