471,584 Members | 1,598 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,584 software developers and data experts.

Moving memory blocks and updating references

hi, I know this is a much-travelled subject, but I was wondering what
people's thoughts were on the bare minimum (and conversely the grand
scheme) for augmenting standard memory references to handle moving
objects around in memory (as is needed in compaction algorithms
associated with 'moving collection' aka 'copy collection').

There are a number of ways to handle this without affecting the
overarching structure of one's program (albeit naive or brute force),
like overloading 'dumb' pointer operators so assignments and copies
invoke the storing of the new reference in a big table. Thusly when a
move is performed on data starting at pointer X, X's references are
extracted from the table and the new location is updated for each of
those references.

A second approach I've seen is creating redirecting 'detour' pointers
that point to the new location after the move. I'm not sure I
completely understand how this works, but topically it seems to make a
mess of memory by leaving these little 4-byte (uint ~= void*) 'bread
crumbs' all over the place.

The most frequent tactics I've seen mentioned are the use of smart
and/or master pointers (possibly evolving to handles). Is this the
best way? It seems like a substantial investment for having to change
the way everything in the existing codebase handles memory references
(not to mention if 3rd party libraries sneak around it), and I'm not
100% sure I understand how it makes moving objects possible (and

If memory gurus can impart their thoughts on the pro and con of
various approaches used to facilitate moving blocks of memory with
existing references in the client application, I'd be much obliged.

Thanks for the help!
Jul 19 '05 #1
0 1820

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Kev | last post: by
5 posts views Thread by Aaron Birkland | last post: by
14 posts views Thread by el_sid | last post: by
8 posts views Thread by Adrian | last post: by
6 posts views Thread by Ark Khasin | last post: by
reply views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.