• 追加された行はこの色です。
  • 削除された行はこの色です。
  • Valgrind へ行く。

[[Profiler]] > [[MemoryProfiler]]

- http://valgrind.org/

>
(-g 付きでコンパイル)
>
$ valgrind --tool=memcheck (プログラム名)


* MacOSX [#macosx]

- valgrind on Mac OS X (10.9) Mavericks
-- http://calvinx.com/2014/05/04/valgrind-on-mac-os-x-10-9-mavericks/
 # Make sure I have autoconf and automake both installed.
 sudo port -v install automake
 sudo port -v install autoconf
 # Grab Frederic's patched valgrind on his "homebrew" branch
 cd ~/work  # My usual project directory
 git clone https://github.com/fredericgermain/valgrind/ -b homebrew
 cd valgrind
 # Because he placed VEX as a git submodule, we have to make sure we clone it too
 git submodule init
 git submodule update
 # With VEX submodule now available, we can compile valgrind
 ./autogen.sh
 ./configure
 make
 # sudo make install
 make install

*. [#l51821b2]

- valgrindの使い方
--  http://kzk9.net/column/valgrind.html ([https://web.archive.org/web/20110529042507/http://kzk9.net/column/valgrind.html webarchive])
>
valgrind --leak-check=full command
>
- --tool=cachegrind(キャッシュミス率を測定)
--  cg_annotate(ボトルネックになっている部分を探す)
- --tool=massif(ヒーププロファイリングを行いメモリ使用量をPostScript形式で可視化)
- --track-fds=yes(ファイルディスクリプタの閉じ忘れを検出)
- --trace-children=yes(子プロセスまでトレース)等

* 関連 [#rel]

- [[Helgrind]]
- [[Callgrind]]

- [[LLVM/Sanitizer]]

- [[heaptrack]]