Debugging C stack usage in Shiny

Hi,

I have a rather large shiny app which produces the following error from a shiny server

Error: C stack usage 489901557988 is too close to the limit
Execution halted

From my research it seems that the app is using more resources than it should for its stack. There is a possibility for me to expand my c stack so this error doesnt appear but i think its just a case of poor programming on my part.

In the linked example it seems the developer created lots of recursive loops to bring on the error. Is there a method in Shiny to trouble shoot something like this. I guess what i would like to be able to do is maybe chart Cstack_info() as elements of my dashboard fire off to see where the big hog of resources is being taken

I realise this is a bit general but any hints would be greatly appreciated

Thank you all very much for your time