忍者ブログ
  • 2024.04
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 2024.06
[PR]
×

[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。

【2024/05/19 14:31 】 |
Xcodeでメモリ周りのデバッグ
Xcodeでデバッグする便利機能いくつか

【メモリのアクセス違反を検知】
Guard Malloc という機能を使う。
これはXcodeにデフォルトで入っている。
使い方は以下のとおり。スキームの設定をする。



参考

その他の機能の説明
Enable Scribble. Fill allocated memory with 0xAA and deallocated memory with 0x55.
Enable Guard Edges. Add guard pages before and after large allocations.
Enable Guard Malloc. Use libgmalloc to catch common memory problems such as buffer overruns and use-after-free.
引用元

zombie objectとは、解放されたメモリをNSZombieObjectにリプレースする機能。
解放済みメモリにアクセス違反したとき、どこにアクセスしたのかなどの情報が分かりやすくなる。
NSZombieObjectの説明


さらにいろんな便利機能
参考
うう〜ん、べんり!


なお、注意点として、Guard Mallocを有効にした状態で実機実行はできない。
以下のエラーが出る。

dyld: could not load inserted library '/usr/lib/libgmalloc.dylib' because image not found


面倒だが、シミュレータのときと実機のときで、スキームから設定を変更しよう。
参考
PR
【2014/12/08 10:45 】 | iPhone | 有り難いご意見(0)
<<cocos2d-xのアニメーション | ホーム | iOS通知のカスタムアクション実装>>
有り難いご意見
貴重なご意見の投稿














<<前ページ | ホーム | 次ページ>>