mpw/test/test_new_handle.c

31 lines
475 B
C
Raw Normal View History

2015-01-13 21:59:43 +00:00
#include <MacMemory.h>
#include <stdio.h>
#include <string.h>
void test_new_handle(unsigned size)
{
unsigned long total = 0;
unsigned long count = 0;
for(;;) {
Handle h = NewHandle(size);
if (!h) {
fprintf(stdout, "memory error: %d\n", MemError());
break;
}
total += size;
count++;
}
fprintf(stdout, "%ld handles allocated\n", count);
fprintf(stdout, "%ld bytes allocated\n", total);
}
int main(void)
{
test_new_handle(1024 * 1024);
return 0;
}