-6

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
}
Frnk Wdl
  • 146
  • 2
  • 11
  • 1
    This function cannot cause a stack overflow - not only is it not recursive, it doesn't even call any other function. – Adrian Oct 23 '19 at 13:22

1 Answers1

2

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.

Volker
  • 40,468
  • 7
  • 81
  • 87