2.7.2 关于 pin 内存与阻塞的疑问
There is something I don’t understand in 2.7.2 of this section: Any perfect technology has its abuse, and this seemingly perfect rule of CGO also has its hidden dangers. Suppose the C language function called takes a long time to run, which will cause the Go language memory referenced by it to be unable to be moved before the C language returns, which may indirectly cause the corresponding goroutine of this Go memory stack to be unable to dynamically expand the stack memory, which may cause the goroutine to be blocked. Therefore, in C language functions that take a long time to run (especially those that, in addition to pure CPU operations, may also need to wait for other resources and may take an uncertain amount of time to complete), it is necessary to handle the Go language memory passed in carefully.
内容来源: chai2010/advanced-go-programming-book