I wrote a C program in which I did some pretty heavy stack allocation, around 2 MiB. Since I use the poor man's IDE* I was automatically running the program via make in order to test it, each time I compiled.
I had pretty much wrapped everything up, but for some reason, during some of the final optimization, I ran it directly from the shell. Instant segfault! Running it with make still worked, and running it by hand always produced the same segfault.
I eventually reduced the amount of stack allocation I was doing to 256 KiB, which solved the problem. My rational was that make was probably exec-ing the process, and thus it was inheriting some weird parameters that allowed it to use more stack space.
Although everything is fine now, I have no way of testing my theory. Can anyone confirm or deny, or suggest some way of testing?
* zsh, vim, gcc, gdb, and some nutty makefiles