Re: Do I need kswapd if I don't have swap?

From: Valdis . Kletnieks
Date: Sat Nov 22 2003 - 22:25:09 EST


On Sat, 22 Nov 2003 17:35:57 PST, David Wuertele <dave-gnus@xxxxxxxxx> said:

> while (1) {
> unsigned char *buf = (unsigned char *) malloc (UNIT);
> if (!buf) return 0;
> totalmalloc += UNIT; fprintf (stderr, "%u ", totalmalloc);
> for (j=0; j<UNIT; j++) buf[j] = j % 256;
> totalwrote += UNIT; fprintf (stderr, "%u ", totalwrote);
> for (j=0; j<UNIT; j++) if (buf[j] != (j % 256)) return -1;
> totalread += UNIT; fprintf (stderr, "%u\n", totalread);
> }

> M26916864
> W26916864
> R26916864

Hmm.. the output doesn't match the fprintf()s. Doesn't give me
warm fuzzies...

> The malloc call isn't even returning. What could explain that?

Alternate theory - the last time through the loop, you get to the fprintf() of
totalread, you go INTO that call, the output makes it out, but some final
malloc() call *within fprintf* or something fails due to being out of memory
(or any number of other failure modes due to being almost but not totally out
of memory), so you never return to start the next iteration of the loop.

Attachment: pgp00001.pgp
Description: PGP signature