So perhaps no need to use this heap-array flag, just leave it blank as system default. Because enabling heap-arrays sometimes will cause some strange performance loss issue.
But then my question is, do I then have to put all the arrays allocable to prevent stack overflow?
Like, what do you guys do, if you do not use heap-arrays0 flag, and also want to prevent stack overflow?
Do you just put all the arrays as allocable?
If so, will you have a lot of allocate and deallocate stuff in your code?
Will that be very cumbersome and also slow down your code a lot? Especially if there are many allocate and deallocate in a big loop.
As @mecej4 already mentioned, this really depends on the usage pattern. If your code has large automatic arrays (let’s say, more than 10,000 elements per array, but that is just simple figure that illustrates the size you can think of), then it pays off to consider using the /heap-arrays option. On the other hand, what you can also do is allocate such arrays explicitly and have them have the SAVE attribute. Then you only need to allocate them once, on the first call. Check that the given size is adequate on the next call though or trust automatic reallocation (that is what it is there for).
It is simply impossible to give general and precise guidelines. The only thing I can think of: do not use this option (other compilers may not have something similar!) and if you run into stack overflows try to solve them by manually managing the arrays.
Here the adagium visualised by xkcd comes into play: 1691: Optimization - explain xkcd