In case anyone else can't run memtest86 overnight without the system
shutting down
for unknown reason I wrote a small userspace memory test/benchmark
utility.
Run fine for about 32 hours on my Supermicro PDSBA with e6300. I get
about 600MB/sec
when I run a single instance of this test.

Makefile:

membench: linbench.c
cc -o membench -g linbench.c

linbench.c:

#include
#include
#include
#include
#include
#define _GNU_SOURCE
#include

#define MB (1024*1024)
#define smb 256*6
size_t size =smb*MB;

int
test1MB(char *arena)
{
int r=random();
size_t wcs=MB/sizeof(int);
wmemset((wchar_t*)arena, r, wcs);
int i=0;
int *arenai=(int*)arena;
for(;i if(arenai[i]!=r) {
fprintf(stderr, "failure at %lx\n", arenai+i);
return 0;
}
}
return 1;
}

char *
printtime(time_t time)
{
static char buf[20];
int hours = time/3600;
int minutes = time%3600/60;
int seconds = time%60;
sprintf(buf, "%d:%02d:%02d", hours, minutes, seconds);
return buf;
}

time_t start;
size_t total;
void
testm(char *arena, size_t size, int pass)
{
memset(arena, random(), size);
total+=size;
time_t endm=time(0);
if(endm!=start)
fprintf(stdout, "pass %d %d MB/sec\n", pass, total/(MB*(endm-start))
);
}

int
test(char *arena, size_t size, int pass)
{
size_t i=0;
for(;i if(!test1MB(arena+i))
return 0;
}
total+=size;
time_t end=time(0);
if(end!=start)
fprintf(stderr, "%d Wrpass %d wrMB/sec %s\r", pass,
total/(MB*(end-start)), printtime(end-start) );
return 1;
}

int
main(int argc, char *argv[])
{
FILE *s=fopen("/proc/swaps", "r");
int c=fgetc(s);
if(c!=EOF) {
fprintf(stderr, "swapoff first\n");
return 1;
}

while (1) {
int this_option_optind = optind ? optind : 1;
int option_index = 0;
static struct option long_options[] = {
{"size", 1, 0, 0},
{0, 0, 0, 0}
};

c = getopt_long (argc, argv, "s:",
long_options, &option_index);
if (c == -1)
break;

switch (c) {
case 0:
printf ("option %s",
long_options[option_index].name);
if (optarg)
printf (" with arg %s", optarg);
printf ("\n");
break;

case 's':
size = atoi(optarg)*MB;
case '?':
break;

default:
printf ("?? getopt returned character code 0%o
??\n", c);
}
}

char *arena=(char*)malloc(size);
start=time(0);
if(!arena) {
fprintf(stderr, "failed to allocate %d MB\n", size/MB);
return 2;
}
fprintf(stderr, "allocated %lx bytes out of %lx addressible\n", size,
(size_t)-1 );
int pass=1;
for(;;++pass) {
if(!test(arena, size, pass))
return 3;
}
return 0;
}
/*
The MIT License

Copyright (c) 2006 Squat'n Dive

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/