更新时间:2023-01-05 08:50:23
您在模拟器中的代码可能有错误,但不会触发 EXC_BAD_ACCESS 只是因为您取消引用的指针不在未映射的内存中.一个指针可能是坏的,可以访问,但没有被检测到——它仍然是一个错误.
Your code in the simulator could have the bug, but isn't triggering EXC_BAD_ACCESS by just the luck that a pointer that you dereference is not in unmapped memory. A pointer could be bad, and accessed, but not detected -- it's still a bug.
你已经检查了没有僵尸消息,这本来是我的第一个建议.
You have already checked to see that no Zombies are messaged, which would have been my first suggestion.
接下来要做的是启用 Guard Malloc -- 然后阅读本文
The next thing to do is Enable Guard Malloc -- and then read this
您只能在模拟器中执行此操作——您的目标是使用超敏感堆使错误在模拟器中抛出 EXC_BAD_ACCESS.
You can only do this in the simulator -- your goal is to use the extra-sensitive heap to make the bug throw EXC_BAD_ACCESS in the simulator.
在文章中: