所以我想用malloc耗尽Windows内存使用量,然后逐步在C中休眠。
我编写了这段代码,但它似乎并没有用尽所有的内存使用量,我不知道还能做些什么。
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main(int argc, char** argv) {
while (1) {
malloc(1024 * 1024);
sleep(1);
}
return 0;
}