From 6072c7f7eabbf6b6f81aa1ee339f4966d0dd9235 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Fri, 25 May 2001 23:20:55 +0000 Subject: Random quick-and-dirty evil malloc checker. --- test/malloc/malloc.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 test/malloc/malloc.c (limited to 'test/malloc/malloc.c') diff --git a/test/malloc/malloc.c b/test/malloc/malloc.c new file mode 100644 index 000000000..698ab5e70 --- /dev/null +++ b/test/malloc/malloc.c @@ -0,0 +1,43 @@ + +#include +#include +#include + +#define N_PTRS 1000 +#define N_ALLOCS 10000 +#define MAX_SIZE 0x10000 + +#define random_size() (random()%MAX_SIZE) +#define random_ptr() (random()%N_PTRS) + +int main(int argc,char *argv[]) +{ + void **ptrs; + int i,j; + int size; + + srandom(0x19730929); + + ptrs = malloc(N_PTRS*sizeof(void *)); + + for(i=0;i