- /*
- * 消耗内存
- */
- #include <stdio.h>
- #include <stdlib.h>
- main()
- {
- int MB=0;
- while(malloc(1<<20))
- ++MB;
- printf("Alloced %d MB total\\n",MB);
- }
- //该片段来自于http://www.codesnippet.cn/detail/2705201512686.html
来源: http://www.codesnippet.cn/detail/2705201512686.html