Xcode - 我的应用程序崩溃,错误是“无效的指针从空闲列表中出列 *** 在 malloc_error_break 中设置一个断点以进行调试”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/29961954/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 07:05:48  来源:igfitidea点击:

Xcode - My app crash and the error is "Invalid pointer dequeued from free list *** set a breakpoint in malloc_error_break to debug"

iosxcodememorymalloc

提问by Nijat2018

My app runs perfect on simulator. But when I run it on device the app crash and display error :

我的应用程序在模拟器上运行完美。但是当我在设备上运行它时,应用程序崩溃并显示错误:

"malloc: * error for object 0x17415d0c0: Invalid pointer dequeued from free list *set a breakpoint in malloc_error_break to debug";

“malloc:* 对象 0x17415d0c0 的错误:从空闲列表中出列的无效指针 *在 malloc_error_break 中设置断点以进行调试”;

I searched and set a breakpoint in malloc_error_breakto debug, but still cannot find the problem. I tried to changed the scheme of project, enabled Zombie Object, but can not find the answer.

我搜索并设置了一个断点malloc_error_break来调试,但仍然找不到问题。我试图改变项目的方案,启用僵尸对象,但找不到答案。

I also try to use instrument, but I am not good at it.

我也尝试使用乐器,但我不擅长。

回答by Andy Sander

I've fixed this error with Xcode 8 on iOS 8.3. I've just changed Deployment Target from 8.3 to 8.0. If the error appears now after migration to Xcode 8 and your device works under control iOS 8 it may be temporary decision.

我已经在 iOS 8.3 上使用 Xcode 8 修复了这个错误。我刚刚将部署目标从 8.3 更改为 8.0。如果迁移到 Xcode 8 后现在出现错误并且您的设备在 iOS 8 的控制下工作,这可能是临时决定。

UPD: Xcode 8.1 beta is fixed this error.

UPD:Xcode 8.1 beta 修复了这个错误。

回答by Dani.Rangelov

Just fixed this same issue with Xcode 8. Preparing an iOS10 compatible build, updated to recommended Swift Migration 2.3, runs perfectly on iOS9 and iOS10 but crashes on iOS8.4. I reverted the changes in the code and the Main.storyboard and built the same content on the iOS8 with Xcode 7.3 fixed my issues.

刚刚用 Xcode 8 修复了同样的问题。准备一个 iOS10 兼容版本,更新到推荐的 Swift Migration 2.3,在 iOS9 和 iOS10 上完美运行,但在 iOS8.4 上崩溃。我恢复了代码和 Main.storyboard 中的更改,并使用 Xcode 7.3 在 iOS8 上构建了相同的内容,修复了我的问题。

回答by ygweric

I met this strange error too, I google it and people said it is Swift's bug, hasn't been fixed. I debug line by line, find out the solution.

我也遇到了这个奇怪的错误,我用谷歌搜索它,人们说这是 Swift 的错误,尚未修复。我一行一行调试,找出解决办法。

The reason this error appears

出现此错误的原因

In EditRecordVCI have generic type function func update<RO>(operation: RO) where RO : RealmOperation, RO.R == EditRecordVC.R

EditRecordVC我有泛型类型函数func update<RO>(operation: RO) where RO : RealmOperation, RO.R == EditRecordVC.R

In its subclass ConflictedRecordEditVC, I override the function, I input update, and Xcode helps me finishing the whole function override func update<RO>(record: Record?, operation: RO?) where RO : RealmOperation, RO.R == Record, compile well.

在它的子类中ConflictedRecordEditVC,我覆盖了这个函数,我输入了update,Xcode帮我完成了整个函数override func update<RO>(record: Record?, operation: RO?) where RO : RealmOperation, RO.R == Record,编译好了。

Run the code, after the overridden function is executed, this error will appear, the Xcode will stop at some random line, nobody can find out it is caused by this function.

运行代码,在重写的函数执行后,会出现这个错误,Xcode会停在某个随机的行,没有人能发现是这个函数引起的。

I debug line by line, find out I have to change the generic type to override func update<RO>(operation: RO) where RO : RealmOperation, RO.R == Record, everything will work well again.

我逐行调试,发现我必须将泛型类型更改为override func update<RO>(operation: RO) where RO : RealmOperation, RO.R == Record,一切都会再次正常运行。

I forget when I added the ?by mistake and Xcode isn't angry.

我忘了什么时候添加的错误地,Xcode 并没有生气。

So check you generic type function and make sure it is exactly same with super class

所以检查你的泛型函数并确保它与超类完全相同