Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is pointer swizzling?

Tags:

c++

c

pointers

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?

like image 694
Pratik Singhal Avatar asked Jan 19 '14 14:01

Pratik Singhal


1 Answers

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.

like image 170
brian beuning Avatar answered Oct 16 '22 20:10

brian beuning