Stack Overflow problem

I have a running app that has a significant amount of code in main and I am trying to split off some of into a separate task but I an encountering a stack overflow. I have assigned a lot more stack to the new task than the main task had when in incoorporated the same code. I commented out the main loop of the new task and it starts fine so this is definitely a stack requirment of the executing code. I suppose I’ll try commenting out parts of the new task to see if there is something within it causing the stack to overflow but it is still perplexing that this same code ran fine winthin main. Any ideas?

Stack Overflow problem

Could it be something in your new or old task is causing a data corruption now they are split from each other, and the data that is being corrupted happens to be the task stack? So not a real stack overflow?

Stack Overflow problem

Often if main() overrun the stack, it might just hit the tail of the heap which might not make cause any problem (Depends on the compiler/linker). A task will have its stack created on the ‘heap’ and if it overflows will tend to be right next to something important.