<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                [TOC] ## 語法 ``` func FreeOSMemory() // 強制進行一次垃圾收集 func PrintStack() func ReadGCStats(stats *GCStats) gc 的stats func SetGCPercent(percent int) int // SetMaxStack設置單個goroutine堆棧可以使用的最大內存量。 // 如果在擴展堆棧時有任何goroutine超出了此限制,程序將崩潰。 // 初始設置在64位系統上為1 GB,在32位系統上為250 MB。 func SetMaxStack(bytes int) int // 該限制控制操作系統線程數 func SetMaxThreads(threads int) int func SetPanicOnFault(enabled bool) bool func SetTraceback(level string) func Stack() []byte ``` ### type GCStats ``` type GCStats struct { LastGC time.Time // time of last collection NumGC int64 // number of garbage collections PauseTotal time.Duration // total pause for all collections Pause []time.Duration // pause history, most recent first PauseEnd []time.Time // pause end times history, most recent first PauseQuantiles []time.Duration } ``` ## 實例 ### debug.PrintStack 打印堆棧 ``` func main() { defer func() { if r := recover(); r != nil { err := r.(error) fmt.Printf("%+v\n", err) debug.PrintStack() } }() demo() time.Sleep(1 * time.Second) } func demo() { demo1() } func demo1() { panic("hello world") } ``` ### ReadGCStats ``` var a debug.GCStats debug.ReadGCStats(&a) fmt.Printf("%+v\n", a) ``` ### Stack ``` // 實現 func Stack() []byte { buf := make([]byte, 1024) for { n := runtime.Stack(buf, false) if n < len(buf) { return buf[:n] } buf = make([]byte, 2*len(buf)) } } ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看