Right.. and each rail has 4 possible places a signal can be, creating a list with a length of about 1 million.
Best is to just signal intersection by intersection.
The stack overflow is interesting. Within that function I can probably get away with not doing it recursively, but not sure elsewhere.
Simplest fix for me would be just to not allow people to use it on 10000 tracks or more or so.
Thanks for the savefile, I'll have a look at it when I got some time