Download

Stack Overflow Unhandled Exception When Saving Map

I get Stack Overflow Unhandled Exception when i try to SAVE my map after editing a TArray Uproperty which contains pointers to up to 26 actors inside thousands of actors used for my pathfinding system. The arrays are there to store each node’s respective neighbors. I have tried writing a function that only calculates portions of these Arrays at a time and saving after each cycle but once i get past a few thousand the editor is guaranteed to crash if i attempt to save.

This is the exception that was triggered when running in debug. It was triggered in corecrt_wstdio.h
which is located in : C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\corecrt_wstdio.h



#else
{
int const _Result = __stdio_common_vswprintf(
_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS,
_Buffer, _BufferCount, _Format, _Locale, _ArgList);

return _Result < 0 ? -1 : _Result;
}
#endif

Here is the callstack:

[ATTACH=JSON]{“data-align”:“none”,“data-size”:“full”,“data-tempid”:“temp_209023_1607492748082_513”,“title”:“Callstack.JPG”}[/ATTACH]
https://forums.unrealengine.com/core/image/gif;base64

Here is the Crash reporter:

[ATTACH=JSON]{“data-align”:“none”,“data-size”:“full”,“data-tempid”:“temp_209024_1607492861817_13”,“title”:“errorreport.JPG”}[/ATTACH]
https://forums.unrealengine.com/core/image/gif;base64

I have 16 gigs of ram and a 16 thread cpu. Is this a memory related issue? I am at a loss.

I just tried increasing the stack size inside of UEBuildWindows.cs and LinkEnvironment.cs.

No change. The editor still crashes when I try to save the updated arrays.

I would recommend Using Heaps If You are getting Stack Overflow errors. Though you would Loose some TArray Functionality and won’t be able to use UPROPERTY() macro but for large data Heap is the way to go.

Thanks but I thought the engines Tarray by default was allocated using heap. How would I do any different?

How would you have suggested I use heap? Could you give me a simple example?

I solved my issue by assigning an ID number to each node based on the order of that node within a single array that all nodes have access to. Each node now creates an array of neighbour ID numbers instead of an array of pointers to neighbours. All i needed to do then was modify my GetNeighbour function to use the id to get the actual pointer from the array that contains all of the nodes. This has reduced interdependency and stopped the overflow.