CGDataProviderCopyData()是否实际复制字节?还是只是指针? [英] Does CGDataProviderCopyData() actually copy the bytes? Or just the pointer?

查看:93
本文介绍了CGDataProviderCopyData()是否实际复制字节?还是只是指针?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尽可能快地连续运行该方法,并且速度越快越好,因此很明显,如果 CGDataProviderCopyData()实际上是逐字节复制数据,那么我认为必须有一种更快的方法来直接访问该数据...这只是内存中的字节.有人知道 CGDataProviderCopyData()是否确实复制了数据吗?还是只是创建一个指向现有数据的新指针?

I'm running that method in quick succession as fast as I can, and the faster the better, so obviously if CGDataProviderCopyData() is actually copying the data byte-for-byte, then I think there must be a faster way to directly access that data...it's just bytes in memory. Anyone know for sure if CGDataProviderCopyData() actually copies the data? Or does it just create a new pointer to the existing data?

推荐答案

已复制字节.

在内部创建CFData(

Internally a CFData is created (CFDataCreate) with the content of the data provider. The CFDataCreate function always make a copy.

这篇关于CGDataProviderCopyData()是否实际复制字节?还是只是指针?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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