3 ms·
Copying also means moving to new addresses. What strategies are used to update the referencing pointers to the new location?
by jeffdavis 14y ago
Copying also means moving to new addresses. What strategies are used to update the referencing pointers to the new location?
- to3m 14y agoThe pointers are updated as you copy them. (If you know the types ahead of time, you therefore structure objects so that they consist of runs of pointers and runs of non-pointers.) Wikipedia has a reasonable explanation of the basic algorithm: http://en.wikipedia.org/wiki/Cheneys_algorithm http://en.wikipedia.org/wiki/Cheneys_algorithm It probably gets more complicated if you try to share it with a non-copying collector, but the basic algorithm is very straightforward to implement.