Photon System Panic - Hard Fault - Task stack size?

I have a rather large Photon application that seems to run as expected but every few hours resets with a reset reason of ‘System Panic’ and resetReasonData = 1. The latter isn’t documented in the photon reference but another posting in the forum states that this indicates a hard fault.

Does anyone know what circumstances can cause a hard fault? I don’t yet see any indication of a memory leak and I don’t do very much dynamic memory allocation. My nominal free memory is around 48K. Could this be an issue of the application task stack overflowing? If so, is there any way to change the allocated stack size without rebuilding the system firmware from scratch? I’d at least like to try this to see if it makes things more stable.

Without seeing your code, my immediate bet would be on “over use” of String objects :wink:

Could you elaborate on the reason for comment? I’m actually an old C programmer so I tend to use old-school character arrays but there is some use of strings in the code. I’ll go ahead and eliminate most of them and see if it makes any difference. I do call the libraries Time.timeStr() function in a few places too.

String objects do tend to produce heap fragmentation that you won’t really see by checking free memory.
And delayed crashes, that’s often a reason for them.
But as said, other reasons might fit the bill too.