On Tue, Sep 23, 2014 at 12:49:56PM +0100, Dave Mitchell wrote: > For example the following simple C code: > > #include <stdio.h> > #include <malloc.h> > > int main(int argc, char**argv) > { > int i; > void *q, *p = malloc(1); > malloc(1); /* poison reallocs */ > for (i=1; i<130; i++) { > q = realloc(p,i); > if (p != q) { > printf("after %3d bytes realloc() using different address\n", i-1); > malloc(i); /* poison reallocs */ > } > p=q; > } > } > > gives this output on my system: > > after 24 bytes realloc() using different address > after 40 bytes realloc() using different address > after 56 bytes realloc() using different address > after 72 bytes realloc() using different address > after 88 bytes realloc() using different address > after 104 bytes realloc() using different address > after 120 bytes realloc() using different address PS I'd be interested in what people get with that code on other OSes. -- Lear: Dost thou call me fool, boy? Fool: All thy other titles thou hast given away; that thou wast born with.Thread Previous | Thread Next