go – How to avoid stack overflow in golang?-ThrowExceptions

Exception or error:

I have problem with calling function multiple times in go exported to dll. Calling it e.g 80 000 times cause stack overflow. Is there any way to avoid it? Can i clear stack or heap after function call?

//export GetNum
func GetNum(DeviceType uint32, DeviceInd uint32, CANInd uint32) int {
return 0
}
How to solve:

Calling it e.g 80 000 times cause stack overflow. Is there any way to avoid it?

Yes, e.g. call it just 10’000 times. Or do not use an recursive algorithm or transform the recursion to normal loop (tail call optimisation).

P.S. Your code does not show any relevant details.

Leave a Reply

Your email address will not be published. Required fields are marked *