Debian Codegraph @

external/bdwgc/tests/middle.c

raw
1 /*
2 * Test at the boundary between small and large objects.
3 * Inspired by a test case from Zoltan Varga.
4 */
5 #include "gc.h"
6 #include <stdio.h>
7
8 int main (void)
9 {
10 int i;
11
12 GC_set_all_interior_pointers(0);
13 GC_INIT();
14
15 for (i = 0; i < 20000; ++i) {
16 (void)GC_malloc_atomic(4096);
17 (void)GC_malloc(4096);
18 }
19 for (i = 0; i < 20000; ++i) {
20 (void)GC_malloc_atomic(2048);
21 (void)GC_malloc(2048);
22 }
23 printf("Final heap size is %lu\n", (unsigned long)GC_get_heap_size());
24 return 0;
25 }