5
5

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.

guard malloc, malloc_historyを使って、addressで何が起こったのかを調べる

Last updated at Posted at 2015-06-20

Xcode を ベースに表題について語ります。

  • memory系のcrashは原因がよくわからないことがよくある
  • guard malloc = on にすることで、どの番地で問題が起きたのかトラップできるようにする
  • MallocStackLogging = on にすると、 memory allocationのhisotryをlogするようになる
  • それができたら、addressと process 番号を引数に malloc_history を叩く
  • その番地のhistoryがでるので、気になる履歴を探る

以上を行うために

  • xcode edit scheme.. -> diagnostics -> Guard Malloc, Malloc Stack に check
  • 開発物をdebug 起動 -> crash を起こす
  • debug window から 問題があるaddressと process number を得る
  • Terminal を開く
  • $malloc_history process address

以上

5
5
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
5
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?