<s>
In	O
computer	B-General_Concept
science	I-General_Concept
,	O
pointer	B-General_Concept
swizzling	I-General_Concept
is	O
the	O
conversion	O
of	O
references	O
based	O
on	O
name	O
or	O
position	B-General_Concept
into	O
direct	O
pointer	O
references	O
(	O
memory	O
addresses	O
)	O
.	O
</s>
<s>
It	O
is	O
typically	O
performed	O
during	O
deserialization	B-Application
or	O
loading	B-Operating_System
of	O
a	O
relocatable	O
object	O
from	O
a	O
disk	O
file	O
,	O
such	O
as	O
an	O
executable	B-Application
file	I-Application
or	O
pointer-based	O
data	B-General_Concept
structure	I-General_Concept
.	O
</s>
<s>
The	O
reverse	O
operation	O
,	O
replacing	O
memory	O
pointers	O
with	O
position-independent	O
symbols	O
or	O
positions	O
,	O
is	O
sometimes	O
referred	O
to	O
as	O
unswizzling	B-General_Concept
,	O
and	O
is	O
performed	O
during	O
serialization	B-Application
(	O
saving	O
)	O
.	O
</s>
<s>
It	O
is	O
easy	O
to	O
create	O
a	O
linked	B-Data_Structure
list	I-Data_Structure
data	B-General_Concept
structure	I-General_Concept
using	O
elements	O
like	O
this	O
:	O
</s>
<s>
But	O
saving	O
the	O
list	O
to	O
a	O
file	O
and	O
then	O
reloading	O
it	O
will	O
(	O
on	O
most	O
operating	O
systems	O
)	O
break	O
every	O
link	O
and	O
render	O
the	O
list	O
useless	O
because	O
the	O
nodes	O
will	O
almost	O
never	O
be	O
loaded	O
into	O
the	O
same	O
memory	B-General_Concept
locations	I-General_Concept
.	O
</s>
<s>
Other	O
options	O
include	O
saving	O
the	O
file	O
offset	B-General_Concept
of	O
the	O
next	O
node	O
or	O
a	O
number	O
indicating	O
its	O
position	B-General_Concept
in	O
the	O
sequence	O
of	O
saved	O
records	O
,	O
or	O
simply	O
saving	O
the	O
nodes	O
in-order	O
to	O
the	O
file	O
.	O
</s>
<s>
After	O
loading	B-Operating_System
such	O
a	O
list	O
,	O
finding	O
a	O
node	O
based	O
on	O
its	O
number	O
is	O
cumbersome	O
and	O
inefficient	O
(	O
serial	O
search	O
)	O
.	O
</s>
<s>
A	O
unique	O
identifier	O
possessed	O
by	O
the	O
pointed-to	O
object	O
,	O
such	O
as	O
a	O
person	O
's	O
Social	O
Security	O
number	O
;	O
in	O
databases	O
,	O
all	O
pointers	O
are	O
unswizzled	O
in	O
this	O
manner	O
(	O
see	O
Foreign	B-Application
key	I-Application
)	O
.	O
</s>
<s>
The	O
reference	O
graph	B-Application
of	O
pointers	O
might	O
contain	O
an	O
arbitrary	O
number	O
of	O
cycles	O
;	O
this	O
complicates	O
maintaining	O
a	O
mapping	O
from	O
the	O
old	O
unswizzled	O
values	O
to	O
the	O
new	O
addresses	O
.	O
</s>
<s>
Associative	B-Application
arrays	I-Application
are	O
useful	O
for	O
maintaining	O
the	O
mapping	O
,	O
while	O
algorithms	O
such	O
as	O
breadth-first	B-Algorithm
search	I-Algorithm
help	O
to	O
traverse	O
the	O
graph	B-Application
,	O
although	O
both	O
of	O
these	O
require	O
extra	O
storage	O
.	O
</s>
<s>
Various	O
serialization	B-Application
libraries	B-Library
provide	O
general	O
swizzling	O
systems	O
.	O
</s>
<s>
In	O
many	O
cases	O
,	O
however	O
,	O
swizzling	O
can	O
be	O
performed	O
with	O
simplifying	O
assumptions	O
,	O
such	O
as	O
a	O
tree	B-Application
or	O
list	O
structure	O
of	O
references	O
.	O
</s>
<s>
For	O
security	O
,	O
unswizzling	B-General_Concept
and	O
swizzling	O
must	O
be	O
implemented	O
with	O
great	O
caution	O
.	O
</s>
<s>
That	O
every	O
offset	B-General_Concept
lies	O
within	O
the	O
bounds	O
of	O
the	O
data	O
read	O
.	O
</s>
