7
* Check that very large allocation requests fail. "Success" would usually
8
* indicate that the the size was somehow converted to a negative
9
* number. Clients shouldn't do this, but we should fail in the
18
GC_set_max_heap_size(100*1024*1024);
19
/* Otherwise heap expansion aborts when deallocating large block. */
20
/* That's OK. We test this corner case mostly to make sure that */
21
/* it fails predictably. */
22
GC_expand_hp(1024*1024*5);
23
if (sizeof(long) == sizeof(void *)) {
24
void *r = GC_MALLOC(LONG_MAX-1024);
27
"Size LONG_MAX-1024 allocation unexpectedly succeeded\n");
30
r = GC_MALLOC(LONG_MAX);
33
"Size LONG_MAX allocation unexpectedly succeeded\n");
36
r = GC_MALLOC((size_t)LONG_MAX + 1024);
39
"Size LONG_MAX+1024 allocation unexpectedly succeeded\n");