什么是指针swizzling? [英] What is pointer swizzling?

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

问题描述

我正在阅读关于wikipedia的整数溢出,并且在看到collumn中遇到了 Pointer Swizzling 这个术语。

我googled关于指针swizzling,但无法理解

任何人都可以解释什么是指针swizzling?

I was reading about integer overflow on wikipedia , and came across the term Pointer Swizzling in the see also collumn.
I googled about pointer swizzling , but couldn't understand it.
Can anyone please explain what is pointer swizzling?

推荐答案

wikipedia页面解释了这一点,让我以另一种方式说。

The wikipedia page explains this, but let me say it another way.

假设您在内存中有一个二叉树数据结构,并且想要将结构保存到磁盘。
不能简单地将结构写入磁盘,因为指针在磁盘上无效。
当你稍后想从磁盘读取二进制树回到内存中时,在树的原始内存副本中使用的地址
可能已在新进程中使用。

Say you have a binary tree data structure in memory and want to save the structure to disk. You can not simply write the structure to disk because the pointers will be invalid on disk. Also when you later want to read the binary tree from disk back into memory, the addresses used in the original memory copy of the tree might already be in use in the new process.

当将磁盘数据读回内存时,指针搅拌将指针转换为从内存写入磁盘的句柄,
并将句柄转换为(不同的)指针。

Pointer swizzling is converting pointers to handles when writing from memory to disk, and also converting handles to (different) pointers when reading the disk data back into memory.

这篇关于什么是指针swizzling?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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