Debug vs. Release Builds

Debug vs. Release Builds

A debug build includes symbols that can be used by a debugger to display your source code when your program stops at a breakpoint and to show you the values of your variables at that point. For a release build, you normally want to strip that information out, because the debug information makes it very easy to reverse-engineer the program. Release builds also typically do code optimization that isn’t done for debug builds. Because the Run action is normally used for debugging, most developers use a debug build configuration for the Run action. However, you might occasionally want to build and run your application with the release configuration to see what size your application will be and to make sure there are no problems introduced by the code optimization; that is, to make sure your application runs as you expect.


Memory Management options:

  • 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.

  • Enable Zombie Objects. Replace deallocated objects with a “zombie” object that traps any attempt to use it. When you send a message to a zombie object, the runtime logs an error and crashes. You can look at the backtrace to see the chain of calls that triggered the zombie detector.

Logging options:

  • Distributed Objects. Enable logging for distributed objects (NSConnectionNSInvocation,NSDistantObject, and NSConcretePortCoder).

  • Garbage Collection Activity. Enable various logging facilities in the garbage-collected memory allocator. Log when a collection occurs, log when new regions are allocated, and log all weak reference manipulations.

  • Malloc Stack. Record stack logs for memory allocations and deallocations.

  • Log Exceptions. Log Objective-C runtime exception handling.

  • Log DYLD API Usage. Log dynamic-linker API calls (for example, dlopen).

  • Log Library Loads. Log dynamic-linker library loads.

Debugger options:

  • Stop on Debugger() and DebugStr(). Enable Core Services routines that enter the debugger with a message. These routines send a SIGINT signal to the current process.

The Xcode static analyzer parses the project source code and identifies these types of problems:

  • Logic flaws, such as accessing uninitialized variables and dereferencing null pointers

  • Memory management flaws, such as leaking allocated memory

  • Dead store (unused variable) flaws

  • API-usage flaws that result from not following the policies required by the frameworks and libraries the project is using



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值