<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>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                [TOC] 參考:https://www.pengrl.com/p/29054/ ## Ubuntu下載valgrind ``` sudo apt-get install valgrind -y ``` ## Go代碼示例 ``` // cstring.go package main /* #include <stdio.h> int c_print(const char* a) { //puts(a); } */ import "C" import ( "reflect" "unsafe" ) func getCString(s string) *C.char{ s = s + "\000" p := (*reflect.StringHeader)(unsafe.Pointer(&s)) return (*C.char)(unsafe.Pointer(p.Data)) } func main() { for i := 0; i < 99999 ; i++ { C.c_print(C.CString("hello world\n")) } } ``` 編譯 ``` go build -o cstring cstring.go ``` ## 簡單使用 ``` valgrind --leak-check=full ./cstring ``` 輸入 ``` ==25893== LEAK SUMMARY: ==25893== definitely lost: 1,299,987 bytes in 99,999 blocks ==25893== indirectly lost: 0 bytes in 0 blocks ==25893== possibly lost: 1,440 bytes in 5 blocks ==25893== still reachable: 0 bytes in 0 blocks ==25893== suppressed: 0 bytes in 0 blocks ==25893== ==25893== For counts of detected and suppressed errors, rerun with: -v ==25893== Use --track-origins=yes to see where uninitialised values come from ==25893== ERROR SUMMARY: 9 errors from 7 contexts (suppressed: 0 from 0) ``` 可以看到,雖然valgrind給出了`definitely lost`的結果,但是幾乎無法直接找到泄漏的位置。
                  <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>

                              哎呀哎呀视频在线观看