What is pointer swizzling?

后端 未结 1 978
我在风中等你
我在风中等你 2020-12-31 09:43

I was reading about integer overflow on wikipedia , and came across the term Pointer Swizzling in the see also collumn.
I googled about pointer swizzlin

1条回答
  •  悲&欢浪女
    2020-12-31 09:54

    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.

    0 讨论(0)
提交回复
热议问题