So, what are the usage conditions? Maybe adding values to the table causes a memory leak?
It's hard to say about the part of the map that has already been traversed; there are many factors involved. I tried to reproduce the bug twice, going to the point of the crash with the same conditions, and it worked normally both times.
And based on my observations, the functions related to calculating the turn also put a significant load on the game – if, for example, you run CalcHeroMoveCost in an infinite loop, the game will start to noticeably lag. And if at the beginning the game can still handle it, then closer to the end of the map, it may run out of resources, hence the crashes.
Added 1 hour 49 minutes ago
No, no matter how hard I tried, I couldn't trigger a crash manually.