Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main(int argc, char** argv) {
- //note: no need for this if we turn off overcommitting below
- //man proc
- //can change oom 'badness' rating this way
- // /proc/[pid]/oom_score -- write to this file as root
- //negatives make it less likely to kill, positives make it more
- //we can make the kernel not overcommit by setting
- ///proc/sys/vm/overcommit_memory to 2
- while(1) {
- unsigned int *all_the_memory = malloc(sizeof(int));
- if(all_the_memory == NULL) {
- printf("failed\n");
- return -1;
- }
- *all_the_memory = 420;
- printf("mem was: %p\n", all_the_memory);
- fflush(stdout);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement