11
13

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

デバッグ版の未初期化メモリパターン

Posted at

http://msdn.microsoft.com/en-us/library/aa260966(VS.60).aspx
から引用します。
Windowsアプリケーションのデバッグ版における未初期化変数は以下の値で埋められます。

Table 1. Potential patterns

Pattern Description
0xFDFDFDFD No man's land (normally outside of a process)
0xDDDDDDDD Freed memory
0xCDCDCDCD Uninitialized (global)
0xCCCCCCCC Uninitialized locals (on the stack)

メモリダンプから原因を切り分ける

デバッガで変数をメモリダンプし、その値から問題を切り分けます。

  • ポインタ先の変数のダンプが、0xFDFDFDFD ならば、ポインタ計算の誤りです。
  • ポインタ先の変数のダンプが、0xDDDDDDDD ならば、メモリ開放して無効になった変数へのアクセスです。
  • 変数のダンプが、0xCDCDCDCD または 0xCCCCCCCC ならば、変数の初期化忘れです。
11
13
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
11
13

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?