博客專欄

        EEPW首頁 > 博客 > valgrind使用

        valgrind使用

        發布人:電子禪石 時間:2025-03-20 來源:工程師 發布文章
        valgrind --tool=memcheck --log-file=log.txt --leak-check=full --show-leak-kinds=all ./test


        =20790== 
        ==20790== HEAP SUMMARY:
        ==20790==     in use at exit: 73,088 bytes in 6 blocks
        ==20790==   total heap usage: 14,543 allocs, 14,537 frees, 1,122,754 bytes allocated
        ==20790== 
        ==20790== 32 bytes in 1 blocks are still reachable in loss record 1 of 6
        ==20790==    at 0x4C2FB55: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
        ==20790==    by 0x5C4D626: _dlerror_run (dlerror.c:141)
        ==20790==    by 0x5C4CFA0: dlopen@@GLIBC_2.2.5 (dlopen.c:87)
        ==20790==    by 0x50FB855: dlfcn_load (in /mnt/hgfs/scm/scm/build/build_ubuntu/lib/libcyber.so)
        ==20790==    by 0x5036053: DSO_load (in /mnt/hgfs/scm/scm/build/build_ubuntu/lib/libcyber.so)
        ==20790==    by 0x5112250: dynamic_ctrl (in /mnt/hgfs/scm/scm/build/build_ubuntu/lib/libcyber.so)
        ==20790==    by 0x504A861: ENGINE_ctrl_cmd_string (in /mnt/hgfs/scm/scm/build/build_ubuntu/lib/libcyber.so)
        ==20790==    by 0x504C16A: ENGINE_by_id (in /mnt/hgfs/scm/scm/build/build_ubuntu/lib/libcyber.so)
        ==20790==    by 0x4F0715C: iwall::EcdsaSigner::MakeSignature(iwall::IKeyPair*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<unsigned char, std::allocator<unsigned char> > const&, std::vector<unsigned char, std::allocator<unsigned char> >&) (ecdsa_signer.cpp:35)
        ==20790==    by 0x4F2F6DF: IW_SAF_EccSign (iwall_saf_crypto.cpp:1513)
        ==20790==    by 0x4F1D08E: IW_SAF_GetCertificateStatus (iwall_saf_cert.cpp:1221)
        ==20790==    by 0x4F4948D: IW_GetCertificateStatus (iwall_pki.c:312)
        ==20790== 
        ==20790== 51 bytes in 1 blocks are definitely lost in loss record 2 of 6
        ==20790==    at 0x4C2E0EF: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
        ==20790==    by 0x4F4C69C: void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag) [clone .isra.28] (basic_string.tcc:223)
        ==20790==    by 0x4F4CCF6: _M_construct_aux<char*> (basic_string.h:195)
        ==20790==    by 0x4F4CCF6: _M_construct<char*> (basic_string.h:214)
        ==20790==    by 0x4F4CCF6: basic_string (basic_string.h:400)
        ==20790==    by 0x4F4CCF6: operator+<char, std::char_traits<char>, std::allocator<char> > (basic_string.h:4786)
        ==20790==    by 0x4F4CCF6: iwall::HttpRequest::SyncRequest(iwall::HttpResponse&) (http_request.cpp:105)
        ==20790==    by 0x4F4ABB2: iwall::HttpHandle::GetRequest(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int) (http_handle.cpp:18)
        ==20790==    by 0x4F59EC2: iwall::X509CRL::CreateFromUrl(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (x509_crl.cpp:87)
        ==20790==    by 0x4F105AB: IW_SAF_DownloadCrl (iwall_saf_cert.cpp:1741)
        ==20790==    by 0x4F1B988: IW_SAF_VerifyCertificateByCrl (iwall_saf_cert.cpp:1865)
        ==20790==    by 0x4F1CF53: IW_SAF_GetCertificateStatus (iwall_saf_cert.cpp:1172)
        ==20790==    by 0x4F4948D: IW_GetCertificateStatus (iwall_pki.c:312)
        ==20790==    by 0x401787: SF_CertificateManagement (iwall_ecc_demo.c:89)
        ==20790==    by 0x4013DF: main (iwall_ecc_demo.c:512)
        ==20790== 
        ==20790== 56 bytes in 1 blocks are indirectly lost in loss record 3 of 6
        ==20790==    at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
        ==20790==    by 0x506CADD: CRYPTO_zalloc (in /mnt/hgfs/scm/scm/build/build_ubuntu/lib/libcyber.so)
        ==20790==    by 0x50A9466: CRYPTO_THREAD_lock_new (in /mnt/hgfs/scm/scm/build/build_ubuntu/lib/libcyber.so)
        ==20790==    by 0x501FAC9: BIO_new (in /mnt/hgfs/scm/scm/build/build_ubuntu/lib/libcyber.so)
        ==20790==    by 0x5023315: BIO_new_fp (in /mnt/hgfs/scm/scm/build/build_ubuntu/lib/libcyber.so)
        ==20790==    by 0x4F07D14: iwall::EcdsaSigner::MakeSignature(iwall::IKeyPair*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<unsigned char, std::allocator<unsigned char> > const&, std::vector<unsigned char, std::allocator<unsigned char> >&) (ecdsa_signer.cpp:64)
        ==20790==    by 0x4F2F6DF: IW_SAF_EccSign (iwall_saf_crypto.cpp:1513)
        ==20790==    by 0x4F1D08E: IW_SAF_GetCertificateStatus (iwall_saf_cert.cpp:1221)
        ==20790==    by 0x4F4948D: IW_GetCertificateStatus (iwall_pki.c:312)
        ==20790==    by 0x401787: SF_CertificateManagement (iwall_ecc_demo.c:89)
        ==20790==    by 0x4013DF: main (iwall_ecc_demo.c:512)
        ==20790== 
        ==20790== 125 bytes in 1 blocks are still reachable in loss record 4 of 6
        ==20790==    at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
        ==20790==    by 0x56DB7E7: vasprintf (vasprintf.c:73)
        ==20790==    by 0x56BAA66: asprintf (asprintf.c:35)
        ==20790==    by 0x5C4D3B6: dlerror (dlerror.c:99)
        ==20790==    by 0x50FB905: dlfcn_load (in /mnt/hgfs/scm/scm/build/build_ubuntu/lib/libcyber.so)
        ==20790==    by 0x5036053: DSO_load (in /mnt/hgfs/scm/scm/build/build_ubuntu/lib/libcyber.so)
        ==20790==    by 0x5112250: dynamic_ctrl (in /mnt/hgfs/scm/scm/build/build_ubuntu/lib/libcyber.so)
        ==20790==    by 0x504A861: ENGINE_ctrl_cmd_string (in /mnt/hgfs/scm/scm/build/build_ubuntu/lib/libcyber.so)
        ==20790==    by 0x504C16A: ENGINE_by_id (in /mnt/hgfs/scm/scm/build/build_ubuntu/lib/libcyber.so)
        ==20790==    by 0x4F0715C: iwall::EcdsaSigner::MakeSignature(iwall::IKeyPair*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<unsigned char, std::allocator<unsigned char> > const&, std::vector<unsigned char, std::allocator<unsigned char> >&) (ecdsa_signer.cpp:35)
        ==20790==    by 0x4F2F6DF: IW_SAF_EccSign (iwall_saf_crypto.cpp:1513)
        ==20790==    by 0x4F1D08E: IW_SAF_GetCertificateStatus (iwall_saf_cert.cpp:1221)
        ==20790== 
        ==20790== 176 (120 direct, 56 indirect) bytes in 1 blocks are definitely lost in loss record 5 of 6
        ==20790==    at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
        ==20790==    by 0x506CADD: CRYPTO_zalloc (in /mnt/hgfs/scm/scm/build/build_ubuntu/lib/libcyber.so)
        ==20790==    by 0x501FA8C: BIO_new (in /mnt/hgfs/scm/scm/build/build_ubuntu/lib/libcyber.so)
        ==20790==    by 0x5023315: BIO_new_fp (in /mnt/hgfs/scm/scm/build/build_ubuntu/lib/libcyber.so)
        ==20790==    by 0x4F07D14: iwall::EcdsaSigner::MakeSignature(iwall::IKeyPair*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<unsigned char, std::allocator<unsigned char> > const&, std::vector<unsigned char, std::allocator<unsigned char> >&) (ecdsa_signer.cpp:64)
        ==20790==    by 0x4F2F6DF: IW_SAF_EccSign (iwall_saf_crypto.cpp:1513)
        ==20790==    by 0x4F1D08E: IW_SAF_GetCertificateStatus (iwall_saf_cert.cpp:1221)
        ==20790==    by 0x4F4948D: IW_GetCertificateStatus (iwall_pki.c:312)
        ==20790==    by 0x401787: SF_CertificateManagement (iwall_ecc_demo.c:89)
        ==20790==    by 0x4013DF: main (iwall_ecc_demo.c:512)
        ==20790== 
        ==20790== 72,704 bytes in 1 blocks are still reachable in loss record 6 of 6
        ==20790==    at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
        ==20790==    by 0x5ED9EFF: ??? (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21)
        ==20790==    by 0x40106F9: call_init.part.0 (dl-init.c:72)
        ==20790==    by 0x401080A: call_init (dl-init.c:30)
        ==20790==    by 0x401080A: _dl_init (dl-init.c:120)
        ==20790==    by 0x4000C69: ??? (in /lib/x86_64-linux-gnu/ld-2.23.so)
        ==20790== 
        ==20790== LEAK SUMMARY:
        ==20790==    definitely lost: 171 bytes in 2 blocks
        ==20790==    indirectly lost: 56 bytes in 1 blocks
        ==20790==      possibly lost: 0 bytes in 0 blocks
        ==20790==    still reachable: 72,861 bytes in 3 blocks
        ==20790==         suppressed: 0 bytes in 0 blocks
        ==20790== 
        ==20790== For counts of detected and suppressed errors, rerun with: -v
        ==20790== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)


        *博客內容為網友個人發布,僅代表博主個人觀點,如有侵權請聯系工作人員刪除。



        關鍵詞: valgrind

        技術專區

        關閉
        主站蜘蛛池模板: 饶阳县| 澄江县| 平南县| 任丘市| 墨江| 诸暨市| 宁蒗| 西盟| 临沂市| 皋兰县| 墨江| 乌鲁木齐县| 托克托县| 大安市| 二连浩特市| 泸西县| 达尔| 石阡县| 胶州市| 桐柏县| 普兰店市| 轮台县| 祥云县| 漳州市| 临海市| 哈巴河县| 华蓥市| 阳曲县| 罗平县| 行唐县| 元谋县| 南宫市| 肥城市| 永清县| 临汾市| 定襄县| 西乌珠穆沁旗| 西乌| 环江| 中西区| 乌兰县|