41

WWDC Lab Q&A

 5 years ago
source link: https://techblog.toutiao.com/2018/06/19/wwdc-lab-q-a/?amp%3Butm_medium=referral
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

WWDC18.jpg

WWDC Lab Q&A

WWDC期间每天都会有苹果工程师现场答疑活动,这种活动叫Lab。以下是我们的Q&A:

Q:记录FPS最准确的方式是什么? A: CADisplayLink会每隔16ms的时候回调一次,如果没回调就说明掉帧,这是目前最好的办法了。

Q: instruments 中记录FPS的方式和CADisplayLink是一样机制么? A: 不太一样,instruments使用了一些debug flag来记录FPS,且不会受设备CPU影响,而CADisplayLink会受设备CPU影响,如runloop调度速度会影响CADisplayLink收到回调的速度。

Q: 如何高效处理线上的野指针问题? A: 目前没有专门的工具检测线上的野指针问题(我:如果野指针crash很难复现,且栈信息没什么用怎么办?)栈信息还是很有用的,你能给我看一个崩溃栈么?

crash_stack.png

这个栈显示是MediaPlayer相关的block被多次释放了,你需要找到这个block以及可能释放该对象的代码,然后用Address Sanitizer看。

Q: 目前LLVM支持C C++ Swift的一些内置attribute,我可以定制attribute么? A: 目前还不支持自定义attribute,你想用这个做什么?(我:配合一些脚本生成代码,就像Java的annotation和注解处理器),C/C++没有任何像Java的东西


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK