objc_release EXC_BAD_ACCESS [英] objc_release EXC_BAD_ACCESS

查看:235
本文介绍了objc_release EXC_BAD_ACCESS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

无法确定此错误发生了什么。



我以多个片段上传文件。



我已经将api调用分成7个并发线程。



这是汇编代码。





这是我的打印的堆栈跟踪





堆栈窗口





除了dispatch_get_low()的#define,我没有任何DISPATCH_QUEUE_PRIORITY_LOW,我没有调用dispatch_get_low()



作为一点背景,我从xcode 4.4开发我的应用程序,最近安装了GM Seed 4.5在ios 6上测试。所有的代码仍然是ios5,这个错误困扰我更新xcode之前和之后。



UPDATE



将NSZombieEnabled YES添加回我的环境变量





程序集断点

$

b
$ b



堆栈跟踪打印输出





调用堆栈窗口





我仍然对实际发生的事情感到失望。



我仍在调查。


$ b

====新发展====

$ b

显然,当试图得到一些malloc调用的输出。我完全缓解了错误。



这是令人沮丧的,因为我不认为我可以编译发布与此标志启用。



>



EXC_BAD_ACCESS不再出现,因此日志将是无用的。



再次更新这个bug是我遇到的最奇怪的问题,我遇到了很多怪异的iOS错误。



我一直在追踪此错误。发现对象是一个问题是一个 - [CFNumber发布] 调用该数字正在块中创建,然后传递给委托。



它也可以与Core Data对象结合保存然后消失。



方法HSLogBrute(@)记录行号和文件名。



我已经跟踪到下面的代码。

  if(progressMatch> progressPercent){
HSLogBrute(@);
TransferStatus * transferStatus = [TransferStatus objectByID:task.transferStatusID];
HSLogBrute(@);
transferStatus.segmentsTransferred = [NSNumber numberWithInt:segmentsTransferred.intValue];
HSLogBrute(@);
transferStatus.segmentsTotal = [NSNumber numberWithInt:segmentsTotal.intValue];
HSLogBrute(@); //这是我得到的最后一个日志。
[transferStatus save];
HSLogBrute(@);
}
HSLogBrute(@); //在放入[NSNumber numberWithInt:]调用之前,这是最后一行。


解决方案

原来我们正在创建一个NSMutableDictionary,它。创建和销毁NSNumbers像我们所做的一样快,似乎在某个时候混淆了弧。这些对象被保留并释放出来。



我的解决方案是创建一个自定义对象,其中包含我需要的数字。并递增和递减这些原始数字类型,而不是创建和销毁这么多NSNumber值。


Unable to determine what is going on with this error.

I am uploading a file in multiple segments.

I have threaded my api calls into 7 concurrent threads.

Here is the assembly code that it stops at.

Here is my printed stack trace

Finally the Stack window

I do not have any DISPATCH_QUEUE_PRIORITY_LOW except for a #define for dispatch_get_low() and I do not have any calls to dispatch_get_low()

as a little background, I am developing my app from xcode 4.4 and recently installed GM Seed 4.5 to test on ios 6. All of my code is still ios5 and this bug plagued me before and after the update of xcode.

UPDATE

After adding back NSZombieEnabled YES to my environment variables

I was presented with a different error in much the same fashion, This one however is called forwarding

Assembly breakpoint

Stack Trace Printout

Call Stack Window

I am still at a loss as to what is actually going on.

I am still investigating. any further assistance will be much appreciated.

==== New Developments ====

Apparently while trying to get some output of the malloc calls. I completely alleviated the bug.

This is disheartening because I dont think I can compile for release with this flag enabled.

the EXC_BAD_ACCESS no longer appears, therefore the log is going to be useless. This bug is turning out to be the weirdest problem I have faced yet, And I have faced a lot of weird iOS bugs.

Update again

I have been tracking this error down. Turns out the object being a problem is a -[CFNumber release] call The number is being created in a block, then being passed down to the delegate.

It may also be combined with the Core Data object saving and then going away.

I have added a method HSLogBrute(@"") which logs the line number and filename.

I have tracked it down to the following code.

    if (progressMatch > progressPercent){
        HSLogBrute(@"");
        TransferStatus *transferStatus = [TransferStatus objectByID:task.transferStatusID];
        HSLogBrute(@"");
        transferStatus.segmentsTransferred = [NSNumber numberWithInt:segmentsTransferred.intValue];
        HSLogBrute(@"");
        transferStatus.segmentsTotal = [NSNumber numberWithInt:segmentsTotal.intValue];
        HSLogBrute(@""); // This is the last log I am getting.
        [transferStatus save];
        HSLogBrute(@"");
    }
    HSLogBrute(@"");// Before putting in the [NSNumber numberWithInt:] calls this was the last line.

解决方案

Turns out we were creating an NSMutableDictionary and using numbers within it. Creating and Destroying NSNumbers as fast as we were doing seems to have confused arc at some point. And the objects were being retained and released out of order.

My solution has been to create a custom object that has the numbers that I need within it. And increment and decrement those primitive number types rather than create and destroy so many NSNumber values.

这篇关于objc_release EXC_BAD_ACCESS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆