iOS 开发常见崩溃分析

1.第一种内存溢出         

    abort(): 函数首先解除进程对SIGABRT信号的阻止,然后向调用进程发送该信号。abort()函数会导致进程的异常终止除非SIGABRT信号被捕捉并且信号处理句柄没有返回

         CorruptMalloc: 堆内存腐化,也就是说默认分配的内存地址很小,但是使用时却超过我们分配的空间(默认一般是不会崩溃的,但是超过一定数量的话就会造成崩溃,一般超过一个 PAGE_SIZE 大小就会崩溃),Xcode 一般提示如下错误: EXC_BAD_ACCESS (code=EXC_I386_GPFLT), 大牛解释:(Basically, the memory allocator allocates pages of memory at once for use by programs, and it gives you a pointer within them (making sure the following space is free for use). Since these pages are usually bigger than 8KiB, you have no issue in your mini-program. But if a larger program is allocating larger amounts of memory and writing further and further past the end of your allocated space, then you’ll end up attempting to write into unallocated memory (or memory used by another program!), thus corrupting memory.)       

2.数据接收时,服务器返回数据不规范,如字典或数组元素中存在null,且客户端没做处理导致的崩溃。

3.内存管理不当,向野指针发送消息导致的崩溃。(此类bug最难解决,所以编码时谨慎)

一般报错为:EXC_BAD_ACCESS

4.数组越界

    -[__NSArrayI objectAtIndex:]: index 100 beyond bounds [0 .. 99]'

5.数据集合类型,如字典、数组中插入元素时,插入空指针nil。

6、 userCorruptObject : 非法对象使用,(__bridge id)将一个 C 指针转换 OC 对象时容易出现,音视频领域常见该问题。

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

大王算法

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值