M
Malcolm McLean
But what happens once you fragment the heap a little, by performing otherRichard Tobin said:Try timing the following program with arguments suitable to the amount
of real memory you have. It doesn't show any sign of super-linearity
on my system.
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
int m = atoi(argv[1]);
int i;
void *buf = 0;
fprintf(stderr, "please wait\n");
for(i=1; i<=m; i++)
if(!(buf = realloc(buf, i)))
{
fprintf(stderr, "realloc(%d) failed\n", i);
return 1;
}
return 0;
}
allocations? You can count the copies, incidentally, simply by testing if
the return pointer equals the input pointer.