Ticket #6637: test.c

File test.c, 448 bytes (added by andreasf, 9 years ago)

test program that works okay

Line 
1#include <stdio.h>
2#include <stdlib.h>
3#include <string.h>
4
5int main(void)
6{
7 size_t size = 128 * 1024 * 1024;
8 void* p;
9
10 p = malloc(size);
11 printf("malloc(%u MiB) = %p\n", size / (1024 * 1024), p);
12 memset(p, 1, size);
13
14 p = realloc(p, size *= 2);
15 printf("realloc(%u MiB) = %p\n", size / (1024 * 1024), p);
16 memset(p, 2, size);
17
18 p = calloc(1, size);
19 printf("calloc(%u MiB) = %p\n", size / (1024 * 1024), p);
20 memset(p, 3, size);
21 return 0;
22}