5 #include "../smalloc.h"
9 #define MAGIC1 0xa9b1c8d2
10 #define MAGIC2 0xf0a1e9b3
16 struct flist_head list;
22 static int do_rand_allocs(void)
24 unsigned int size, nr, rounds = 0;
28 while (rounds++ < LOOPS) {
33 while (total < 128*1024*1024UL) {
34 size = 8 * sizeof(struct elem) + (int) (999.0 * (rand() / (RAND_MAX + 1.0)));
37 printf("fail at %lu, size %u\n", total, size);
43 flist_add_tail(&e->list, &list);
47 printf("Got items: %u\n", nr);
49 while (!flist_empty(&list)) {
50 e = flist_entry(list.next, struct elem, list);
51 assert(e->magic1 == MAGIC1);
52 assert(e->magic2 == MAGIC2);
61 static int do_specific_alloc(unsigned long size)
70 int main(int argc, char *argv[])
77 /* smalloc bug, commit 271067a6 */
78 do_specific_alloc(671386584);