Created
February 14, 2014 13:48
-
-
Save sirupsen/9001258 to your computer and use it in GitHub Desktop.
Virtual memory to physical memory.
This file contains hidden or 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
$ ps -o rss,command | grep ./omg | grep -v grep | |
488 ./omg | |
$ ps -o rss,command | grep ./omg | grep -v grep | |
10268 ./omg |
This file contains hidden or 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 <stdlib.h> | |
#include <stdio.h> | |
#include <sys/time.h> | |
#include <sys/resource.h> | |
#include <unistd.h> | |
int main() { | |
int* lol = malloc(sizeof(int) * 10000000); | |
sleep(10); | |
printf("Touching memory pages..\n"); | |
for (size_t i = 1; i < 10000000; i += getpagesize()) | |
lol[i] = 82; | |
printf("Done touching memory pages..\n"); | |
sleep(10); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment