32
29

More than 5 years have passed since last update.

valgrindメモ

Last updated at Posted at 2013-12-17

valgrindとは

  • Valgrind は、メモリデバッグや、メモリリークの検出、プロファイリングを行うためのプログラミングツール

検出可能なこと

  • 未初期化メモリの使用
  • 解放されたメモリの読み書き
  • 確保されたされたメモリブロック外のアクセス
  • 確保したメモリのメモリ解放忘れ

使用方法

valgrind -v --error-limit=no --leak-check=full --show-reachable=no build/valgrind_test

オプションの意味

  • -v

    詳細表示

  • --error-limit=no

    エラー追跡をやめない

  • --leak-check=full

    メモリリークを最大限チェックする

  • --show-reachable

    still reachableをエラーをレポートに表示しない。

メモリリークの種類

  • definitely lost:メモリリークしている。
  • possibly lost:メモリリークしているかも?確認
  • still reachable:解放できるメモリを解放していない。レポートが邪魔なら--show-reachable=yesを使用しないこと
  • suppressed:メモリリークエラーが抑制されている。

参考資料

32
29
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
32
29