scrubber.c

Larry McVoy (lm@bitmover.com)
Wed, 24 Feb 1999 16:36:56 -0800


Several people have asked for this.

/*
* scrubber.c - exercise memory
* This never stops, nor does it change the bit pattern, both of which
* might be a good addition.
*/
main(int ac, char **av)
{
if (ac != 2) {
printf("Usage: %s amount_in_MB\n", av[0]);
exit(0);
}
doit(atoi(av[1])<<20);
}

doit(int bs)
{
int *buf = malloc(bs);
int *end;
int *p;
int off;

if (!buf) {
perror("malloc");
exit(1);
}
end = (char*)buf + bs;
for (off = 0, p = buf; p < end; *p++ = off, off += 4);
for (;;) {
for (off = 0, p = buf; p < end; *p++ = off, off += 4) {
if (*p != off) printf("BAD@%u - %u\n", off, *p);
}
write(1, ".", 1);
}
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/