#include <stdio.h>
int main()
{
int n[100000];
int t,q;
int i,j;
char s[3][100000];
char qstr[3][200][100000];
printf("Success\n");
}
In the above code the size of qstr
is about 57.22 MiB. Why is there a Segmentation fault when more than 1 GiB of free memory is still available?
If I change the declaration of qstr
as qstr[3][200][10000]
the program has no trouble executing and "Success" is actually printed, after which it exits. In this case 'qstr' is only occupying about 5.7 MiB.
I have 2 questions:
How do I know the limit?
Given that I've way more free memory, how do I exploit it?