2013-06-27 59 views
0

有沒有人知道任何有關在RAM上進行walkpat內存測試的好資源?如果您可以提供更好的僞代碼或C代碼。提前致謝!Walkpat內存測試

+0

此網頁非常有用:http://www.ganssle.com/testingram.htm – Peter

回答

0
volatile int *ptr; // volatile because the compiler would otherwise outsmart you and not actually read the memory 

for(ptr=0; ptr<SIZE; ptr++) { 
    int test = 1; 
    do { 
     *ptr = test; 
     if(*ptr != test) FAIL(); 
     test <<= 1;  // walk that 1 through the word, until it falls off the end. 
    } while(test); 
}