Do you use ECC memory?

Do you use ECC memory?

  • Yes

    Votes: 11 42.3%
  • No

    Votes: 15 57.7%

  • Total voters
    26
Status
Not open for further replies.

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
Well hell that's easy enough to write, assuming you don't mind a UNIX kernel running. Allocate a block of memory. Lock it in-core. Write it with your pattern. Read it back in a continuous loop. It isn't going to be as rigorous as something like memtest86 though.

I figured it was something like that, but I don't know how to actually do that. :P
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
Code:
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>

int main(int argc, char *argv[])
{
        size_t s;
        int i, niter = 1;
        unsigned char fill, *base, *ptr, *last;

        if (argc != 3) {
                fprintf(stderr, "usage: memfun <fillbyte> <nbytes>\n");
                exit(1);
        }
        i = atoi(argv[1]);
        if (i < 0 || i > 255) {
                fprintf(stderr, "fillbyte needs to be 0...255\n");
                exit(1);
        }
        fill = i;
        s = atoll(argv[2]); /* not good */

        if (! ((base = malloc(s)))) {
                fprintf(stderr, "unable to malloc %lld\n", s);
                exit(1);
        }

        if (mlock(base, s) < 0) {
                perror("warning, mlock failed");
        }
        last = base + s;
        for (ptr = base; ptr < last; ptr++) {
                *ptr = fill;
        }
        for (;; niter++) {
                fprintf(stderr, "start iter %d\r", niter);
                for (ptr = base; ptr < last; ptr++) {
                        if (*ptr != fill) {
                                fprintf(stderr, "err at loc %d iter %d\n", ptr - base, niter);
                        }
                }
        }
}


well anyways it shows lazy in several ways, including that it only works up to 4GB, but hey you can run several copies. Be sure to run it as root. Then I'll tell you I didn't work real hard on it so it's probably full of bugs and 100% guaranteed not-proper-coding things.
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
I have no idea how to compile that.. so I guess I need to start reading :D
 
Status
Not open for further replies.
Top