为什么要紧急恢复buf大小为64 << 10?

时间:2019-04-23 13:03:27

标签: go stack

我看到了很多代码片段,这些片段在golang中会恢复正常。就像这样:

func PanicRecover(c context.Context) {
    if e := recover(); e != nil {
        const size = 64 << 10
        buf := make([]byte, size)
        buf = buf[:runtime.Stack(buf, false)]
        logs.CtxError(c, "Error: %s", string(buf))
    }
}

我想知道为什么缓冲区大小总是64 << 10。

0 个答案:

没有答案