lkml.org 
[lkml]   [2003]   [Nov]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: Do I need kswapd if I don't have swap?
From
Date
On Sat, 22 Nov 2003 17:35:57 PST, David Wuertele <dave-gnus@bfnet.com>  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.

[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2005-03-22 13:58    [W:0.045 / U:0.920 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site