7 /* Ignore misleading "Out of Memory!" warning (which is printed on */
8 /* every GC_MALLOC(LONG_MAX) call) by defining this macro before */
9 /* "gc.h" inclusion. */
10 # define GC_IGNORE_WARN
16 * Check that very large allocation requests fail. "Success" would usually
17 * indicate that the size was somehow converted to a negative
18 * number. Clients shouldn't do this, but we should fail in the
26 GC_set_max_heap_size(100*1024*1024);
27 /* Otherwise heap expansion aborts when deallocating large block. */
28 /* That's OK. We test this corner case mostly to make sure that */
29 /* it fails predictably. */
30 GC_expand_hp(1024*1024*5);
31 if (sizeof(long) == sizeof(void *)) {
32 void *r = GC_MALLOC(LONG_MAX-1024);
35 "Size LONG_MAX-1024 allocation unexpectedly succeeded\n");
38 r = GC_MALLOC(LONG_MAX);
41 "Size LONG_MAX allocation unexpectedly succeeded\n");
44 r = GC_MALLOC((size_t)LONG_MAX + 1024);
47 "Size LONG_MAX+1024 allocation unexpectedly succeeded\n");