Created
April 13, 2020 06:09
-
-
Save changyeon/d26448049879cb17cb1dac68314906ef to your computer and use it in GitHub Desktop.
Test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
int main(int argc, char *argv[]) | |
{ | |
char *buf = NULL, *p = NULL; | |
unsigned long i, page_size = 4096, offset = 0, buf_size = 1UL << 10UL; | |
setbuf(stdout, NULL); | |
printf("Call a malloc: %p\n", buf); | |
buf = malloc(buf_size); | |
printf("Hello World: %p\n", buf); | |
for (i = 0; i < (buf_size / page_size); i++) { | |
offset = page_size * i; | |
p = buf + offset; | |
*p = i; | |
} | |
free(buf); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment