linux安裝valgrind

來源:互聯網
上載者:User

標籤:linux   雲端服務器   valgrind   記憶體泄露   記憶體越界   

       最近伺服器程式出了一個崩潰,確定是記憶體位址訪問越界,但是不能定位在哪裡,沒辦法只好用valgrind來跑一下,以前公司的伺服器是上都預設安裝了,突然發現雲端服務器上沒有安裝這個軟體,所以記錄一下如何安裝。

       1、下載最新版本的valgrind:
       http://www.valgrind.org/downloads/valgrind-3.9.0.tar.bz2
解壓安裝包:tar –jxvf valgrind-3.9.0.tar.bz2,解壓後組建目錄valgrind-3.9.0。

      目前支援的平台,在官網上列表如下:
      {x86,amd64,arm,ppc32,ppc64,s390x,mips32,mips64}-linux, arm-android (2.3 and later), x86-android (4.0 and later) and {x86,amd64}-darwin (Mac OS X 10.7, with limited support for 10。

      2、安裝前配置編譯選項,所以配置如下:

      # cd valgrind-3.9.0

      # ./autogen.sh

      # ./configure --prefix=/home/valgrind/bin

      3、編譯和安裝valgrind

      # make

      # make install

      4、到這來已經安裝成功了,但還不能直接使用,需要建立一個軟串連。

      # cd /usr/bin/

      # ln -s /home/valgrind/bin/bin/valgrind valgrind

      最後我們測試一下吧,如果運行so檔案失敗,可能需要設定庫目錄。

      # export LD_LIBRARY_PATH=`pwd`      

      # valgrind ./WorldFrame_d -c 2

      然後看看終端的顯示,確定是否正確安裝。      

      ==30079== Memcheck, a memory error detector      ==30079== Copyright (C) 2002-2013, and GNU GPL‘d, by Julian Seward et al.      ==30079== Using Valgrind-3.9.0 and LibVEX; rerun with -h for copyright info      ==30079== Command: ./WorldFrame_d -c 2      ==30079==       begin load xml...      begin read file...      fileLength = 846      begin decrypt file...      pTiXmlDocument::begin parse file...      ==30079== Conditional jump or move depends on uninitialised value(s)      ==30079==    at 0x50F351F: TiXmlBase::StringEqual(char const*, char const*, bool,       TiXmlEncoding) (tinyxmlparser.cpp:549)      ==30079==    by 0x50F426F: TiXmlElement::Parse(char const*, TiXmlParsingData*, TiXmlEncoding) (tinyxmlparser.cpp:1094)      ==30079==    by 0x50F399D: TiXmlDocument::Parse(char const*, TiXmlParsingData*, TiXmlEncoding) (tinyxmlparser.cpp:744)      ==30079==    by 0x50E8049: CSchemeEngine::__LoadXML(char const*, bool, TiXmlDocument*) (SchemeEngine.cpp:353)      ==30079==    by 0x50E7E29: CSchemeEngine::__Load(char const*, CCsvReader*, TiXmlDocument*, bool&) (SchemeEngine.cpp:277)      ==30079==    by 0x50E76B1: CSchemeEngine::LoadScheme(char const*, ISchemeUpdateSink*) (SchemeEngine.cpp:92)      ==30079==    by 0x4391D0: ServerScheme::LoadScheme(ISchemeEngine*, char const*, unsigned int) (ServerScheme.cpp:11)      ==30079==    by 0x433E0A: main (ServerApp.cpp:62)      ==30079==       ==30079== Conditional jump or move depends on uninitialised value(s)      ==30079==    at 0x50F2D35: TiXmlBase::SkipWhiteSpace(char const*, TiXmlEncoding) (tinyxmlparser.cpp:315)      ==30079==    by 0x50F3ABB: TiXmlDocument::Parse(char const*, TiXmlParsingData*, TiXmlEncoding) (tinyxmlparser.cpp:770)      ==30079==    by 0x50E8049: CSchemeEngine::__LoadXML(char const*, bool, TiXmlDocument*) (SchemeEngine.cpp:353)      ==30079==    by 0x50E7E29: CSchemeEngine::__Load(char const*, CCsvReader*, TiXmlDocument*, bool&) (SchemeEngine.cpp:277)      ==30079==    by 0x50E76B1: CSchemeEngine::LoadScheme(char const*, ISchemeUpdateSink*) (SchemeEngine.cpp:92)      ==30079==    by 0x4391D0: ServerScheme::LoadScheme(ISchemeEngine*, char const*, unsigned int) (ServerScheme.cpp:11)      ==30079==    by 0x433E0A: main (ServerApp.cpp:62)      ==30079==       Sock.dll, version 30       --LongWorkerProc(), long worker thread startup, id=30080    

linux安裝valgrind

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.