*** empty log message ***

This commit is contained in:
hjp 2000-02-03 23:49:45 +00:00
parent 8158f1a3b0
commit 0cf4c4025a
1 changed files with 22 additions and 0 deletions

22
hogs/memhog.c Normal file
View File

@ -0,0 +1,22 @@
#include <stdlib.h>
#include <stdio.h>
int main(void) {
size_t s = 0x100000;
size_t sum = 0;
while (s) {
void *p;
if (p = malloc(s)) {
sum += s;
printf("%lu - %lu\n",
(unsigned long)s,
(unsigned long)sum);
sleep (1);
memset(p, 'a', s);
s *= 2;
} else {
s /= 2;
}
}
return 0;
}