X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=hs-boehmgc.git;a=blobdiff_plain;f=gc-7.2%2Ftests%2Fsmash_test.c;fp=gc-7.2%2Ftests%2Fsmash_test.c;h=0e8b1f0808918a7ab783bc6cfc4b1e97360cf47b;hp=0000000000000000000000000000000000000000;hb=324587ba93dc77f37406d41fd2a20d0e0d94fb1d;hpb=2a4ea609491b225a1ceb06da70396e93916f137a diff --git a/gc-7.2/tests/smash_test.c b/gc-7.2/tests/smash_test.c new file mode 100644 index 0000000..0e8b1f0 --- /dev/null +++ b/gc-7.2/tests/smash_test.c @@ -0,0 +1,28 @@ +/* + * Test that overwrite error detection works reasonably. + */ +#define GC_DEBUG +#include "gc.h" + +#include + +#define COUNT 7000 +#define SIZE 40 + +char * A[COUNT]; + +int main(void) +{ + int i; + char *p; + + GC_INIT(); + + for (i = 0; i < COUNT; ++i) { + A[i] = p = GC_MALLOC(SIZE); + + if (i%3000 == 0) GC_gcollect(); + if (i%5678 == 0 && p != 0) p[SIZE + i/2000] = 42; + } + return 0; +}