tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: lookup on memory shortage



On Fri, Oct 03, 2008 at 01:14:34PM +0200, Manuel Bouyer wrote:
> On Fri, Oct 03, 2008 at 01:11:05PM +0200, Manuel Bouyer wrote:
> > Hi,
> > I got a lockup again. I had top running, here's what it displayed before
> > the box wedged:
> > 
...snip...
> > 
> > This time I don't understand where the memory has gone, because there's
> > no big processes running (unless cc1 has grown a lot after the last top
> > display, and before the box hanging).
> 
> Additionnal info: after reboot and looking at the pbulk log, it was
> building the stalin, which is knows to produce a cc1 process which grows very
> large. So the memory may have been in cc1, but top didn't have time to show
> it.

hmm... I recently threw some extra ram into one of my machines, and to test it
out a bit wrote a program that allocates and touches memory in a loop.  One
of the times I ran it, it got killed because the system ran out of memory
(which is what I expected) and the system recovered.  The other times, almost
everything hung except that I was able to hit ^C (on a text wscons console)
and it recovered.  Perhaps your hang is similar?  Does running this program
reproduce your problem?

#include <stdio.h>
#include <malloc.h>
#include <string.h>
int main()
{
        int jj = 0;
        int alloc = 1024 * 1024 * 10;
        while(1)
        {
                char *p = malloc(alloc);
                if (p == NULL)
                {
                        fprintf(stderr, "failed\n");
                        sleep(30);
                        exit(1);
                }
                memset(p, jj, alloc);
                if (memcmp(p, p+(alloc/2), alloc/2) != 0)
                {
                        fprintf(stderr, "corrupted memory\n");
                        exit(1);
                }
                fprintf (stderr, "%d ", jj++);
        }
}



Home | Main Index | Thread Index | Old Index