Last active
October 9, 2019 15:26
-
-
Save Beyarz/b243c06fe0040373cbe85e0c62922e5a to your computer and use it in GitHub Desktop.
When allocating memory using malloc, malloc sends the enomem error if the amount of memory requested exceeds the _heap_maxreq. This script bypasses that.
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
// Working on Windows 10 Insider Preview 18356.1 (19h1_release) | |
#include <stdio.h> | |
#include <stdlib.h> | |
#define byte sizeof(int) | |
int main(){ | |
char *ptr; | |
puts("Allocating..."); | |
for(int z = 0; z != -1; z++){ | |
ptr = (char *)malloc(byte); | |
if(ptr == NULL){ | |
puts("Failed to allocate!"); | |
return 1; | |
} | |
} | |
// free(ptr); - not useful if it's running infinitely. | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment