Segmentation fault with ulimit set correctly
问题 I tried to help an OP on this question. I found out that a code like the one below causes segmentation fault randomly even if the stack is set to 2000 Kbytes. int main () { int a[510000]; a[509999] = 1; printf("%d", a[509999]); return 0; } As you can see the array is 510000 x 4 bytes = 2040000 bytes. The stack is set to 2000 Kbytes (2048000 bytes) using ulimit command: ulimit -s 2000 ulimit -Ss 2000 Based on those numbers the application has room to store the array, but randomly it return