的malloc:***错误对象:免费列表离队无效的指针***设置malloc_error_break断点在神奇纪录IOS
问题描述:
调试当过我尝试使用MR_importValuesForKeysWithObject我的应用程序崩溃来插入数据:的malloc:***错误对象:免费列表离队无效的指针***设置malloc_error_break断点在神奇纪录IOS
malloc:对象错误0x174291c0e:无效指针从空闲列表中出列。
在malloc_error_break中设置断点以进行调试。它崩溃
代码是:
+ (NSArray *) MR_executeFetchRequest:(NSFetchRequest *)request inContext:(NSManagedObjectContext *)context
{
__block NSArray *results = nil;
[context performBlockAndWait:^{
NSError *error = nil;
results = [context executeFetchRequest:request error:&error];
if (results == nil)
{
[MagicalRecord handleErrors:error];
}
}];
return results;
}
堆栈帧 -
#0 0x000000018ac3a014 in __pthread_kill()
#1 0x000000018ad02450 in pthread_kill()
#2 0x000000018abae3e0 in abort()
#3 0x000000018ac7ea38 in nanozone_error()
#4 0x000000018ac80bf0 in _nano_malloc_check_clear()
#5 0x000000018ac7fbb4 in nano_calloc()
#6 0x000000018ac71180 in malloc_zone_calloc()
#7 0x000000018ac710c4 in calloc()
#8 0x000000018a6af510 in class_createInstance()
#9 0x000000018a6bdae4 in _objc_rootAlloc()
#10 0x000000018df40298 in -[NSSQLGenerator generateSelectIntermediateInContext:]()
#11 0x000000018df3f584 in -[NSSQLGenerator generateIntermediatesForFetchInContext:countOnly:]()
#12 0x000000018e04c314 in -[NSSQLGenerator newSQLStatementForRequest:ignoreInheritance:countOnly:nestingLevel:nestIsWhereScoped:requestContext:]()
#13 0x000000018e04e940 in -[NSSQLiteAdapter _statementForFetchRequestContext:ignoreInheritance:countOnly:nestingLevel:]()
#14 0x000000018e04eaf4 in -[NSSQLiteAdapter newSelectStatementWithFetchRequestContext:ignoreInheritance:]()
#15 0x000000018e0fb820 in -[NSSQLFetchRequestContext _createStatement]()
#16 0x000000018e0fb790 in -[NSSQLFetchRequestContext fetchStatement]()
#17 0x000000018e0fc8fc in -[NSSQLFetchRequestContext executeRequestUsingConnection:]()
#18 0x000000018e010e98 in __52-[NSSQLDefaultConnectionManager handleStoreRequest:]_block_invoke()
#19 0x0000000101dc121c in _dispatch_client_callout()
#20 0x0000000101dcde38 in _dispatch_barrier_sync_f_invoke()
#21 0x000000018e010d34 in -[NSSQLDefaultConnectionManager handleStoreRequest:]()
#22 0x000000018e0d6ec4 in -[NSSQLCoreDispatchManager routeStoreRequest:]()
#23 0x000000018e03fd04 in -[NSSQLCore dispatchRequest:withRetries:]()
#24 0x000000018e03abc4 in -[NSSQLCore processFetchRequest:inContext:]()
#25 0x000000018df3d518 in -[NSSQLCore executeRequest:withContext:error:]()
#26 0x000000018e01d844 in __65-[NSPersistentStoreCoordinator executeRequest:withContext:error:]_block_invoke()
#27 0x000000018e015f90 in -[NSPersistentStoreCoordinator _routeHeavyweightBlock:]()
#28 0x000000018df3d1cc in -[NSPersistentStoreCoordinator executeRequest:withContext:error:]()
#29 0x000000018df3bbf4 in -[NSManagedObjectContext executeFetchRequest:error:]()
#30 0x000000018dfecb90 in -[NSManagedObjectContext(_NestedContextSupport) _parentObjectsForFetchRequest:inContext:error:]()
#31 0x000000018dfed398 in __82-[NSManagedObjectContext(_NestedContextSupport) executeRequest:withContext:error:]_block_invoke()
#32 0x000000018dfef640 in internalBlockToNSManagedObjectContextPerform()
#33 0x0000000101dc121c in _dispatch_client_callout()
#34 0x0000000101dcde38 in _dispatch_barrier_sync_f_invoke()
#35 0x000000018dfdc9b0 in _perform()
#36 0x000000018dfed088 in -[NSManagedObjectContext(_NestedContextSupport) executeRequest:withContext:error:]()
#37 0x000000018df3bbf4 in -[NSManagedObjectContext executeFetchRequest:error:]()
#38 0x00000001013df24c in __67+[NSManagedObject(MagicalRecord) MR_executeFetchRequest:inContext:]_block_invoke at /Users/Desktop/Core Data/glider/Pods/MagicalRecord/MagicalRecord/Categories/NSManagedObject/NSManagedObject+MagicalRecord.m:54
#39 0x000000018dfe1b70 in developerSubmittedBlockToNSManagedObjectContextPerform()
#40 0x0000000101dc121c in _dispatch_client_callout()
#41 0x0000000101dd1e5c in _dispatch_barrier_sync_f_slow_invoke()
#42 0x0000000101dc121c in _dispatch_client_callout()
#43 0x0000000101dc6284 in _dispatch_main_queue_callback_4CF()
#44 0x000000018bc17f2c in __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__()
#45 0x000000018bc15b18 in __CFRunLoopRun()
#46 0x000000018bb44048 in CFRunLoopRunSpecific()
#47 0x000000018d5ca198 in GSEventRunModal()
#48 0x0000000191b302fc in -[UIApplication _run]()
#49 0x0000000191b2b034 in UIApplicationMain()
请给我一些暗示。
答
如果得到响应数据对象的形式排列那么它的好,我们应该通过遍历一个对象使用
let defaultcontext = NSManagedObjectContext.MR_defaultContext()
Entityname.MR_importFromArray(listOfObjectData: [[NSObject : AnyObject]], inContext:defaultcontext)
defaultcontext.MR_saveToPersistentStoreAndWait()
而不是插入,然后将其保存在
后崩溃日志或完全回溯(设置了断点后)。 – bbum
我已经更新崩溃堆栈框架 –
哦,喜悦。你在某处找到了一个记忆碎片。寻找缓冲区溢出等。不幸的是,malloc()指出事情已经走出轨道的时间太晚了。 尝试打开乐器中的Malloc调试。 – bbum