middle.c 518 B

1234567891011121314151617181920212223242526
  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. int main ()
  8. {
  9. int i;
  10. GC_all_interior_pointers = 0;
  11. for (i = 0; i < 20000; ++i) {
  12. GC_malloc_atomic (4096);
  13. GC_malloc (4096);
  14. }
  15. for (i = 0; i < 20000; ++i) {
  16. GC_malloc_atomic (2048);
  17. GC_malloc (2048);
  18. }
  19. printf("Final heap size is %ld\n", GC_get_heap_size());
  20. return 0;
  21. }