리눅스
memtest.c
Ben Ko (SINCE 2013)
2013. 1. 17. 17:30
728x90
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#define NA_GIGABYTE (1024 * 1024 * 1024)
int main() {
char *nhko_memory;
char *init;
long megabyte = NA_GIGABYTE;
long i;
nhko_memory = (char *)malloc(megabyte);
init = nhko_memory;
while (1) {
for (i=0; i<NA_GIGABYTE; i++) {
*nhko_memory='a';
nhko_memory++;
}
nhko_memory = init;
}
}