Design Element
Comment on "Things Developers Should Know About Leopard"
by Steve Weller — Sep 29
You can't conclude that the "copying" is all the way down just because you get different addresses back. It depends on the implementation.

If the object you copy is mutable then an efficient copy can't reuse the object data directly like it can with a mutable one -- what would happen if you modified it? But it can give you back a proxy object with a new address and track which proxies are sharing the actual data.

Only when a write occurs does the data (or part of it) actually get copied. Or even better, the changes are tracked and nothing gets copied until the data is actually used for something. "Copying" may do very little until the address of the bit map is returned to you.
Back to "Things Developers Should Know About Leopard"
Design Element

Copyright © Scott Stevenson 2004-2015