I was shown an optimization solver that ran fine with certain parameter sizes,
yet started segfaulting with larger problem sizes. It turned out that a desired
single large, amorphous array could not be allocated within the available stack
size limit.
Increasing the stack size limit via ulimit -s 50000 (for example) fixed
the problem.
You can view a shell’s resource limits using, for example,
> ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) 6144
file size (blocks, -f) unlimited
max locked memory (kbytes, -l) unlimited
max memory size (kbytes, -m) unlimited
open files (-n) 256
pipe size (512 bytes, -p) 1
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 266
virtual memory (kbytes, -v) unlimited