linux-mips
[Top] [All Lists]

Memory corruption

To: linux@cthulhu.engr.sgi.com
Subject: Memory corruption
From: Ulf Carlsson <ulfc@thepuffingroup.com>
Date: Tue, 22 Jun 1999 03:39:31 +0200
Mail-followup-to: linux@cthulhu.engr.sgi.com
Sender: owner-linux@cthulhu.engr.sgi.com
Hi,

The compiler may stop working sometimes on certain files, giving bogus error
messages which I don't understand (the compiler is probably not the only
application affected).  Running this program I just wrote forces the corrupted
caches to be flushed or something and ``fixes'' the problems:

int main(void)
{
        unsigned long tot = 0;
        unsigned long i = 1 << 20;
        void *p;
        int failures = 0;

        while (i) {
                p = malloc(i);
                if (!p) {
                        if (failures++ < 10)
                                continue;
                        i = i >> 1;
                        failures = 0;
                        continue;
                }
                memset(p, 0, i);
                tot += i;
        }
        printf("Total memory set: %u kb\n", tot >> 10);
}

Maybe I should put this in my crontab along with sync :-)

Does anyone else notice these problems?

- Ulf

<Prev in Thread] Current Thread [Next in Thread>