From Hex Fiend Wiki

Developers: SharedMemoryByteSlice

SharedMemoryByteSlice is a concrete subclass of ByteSlice that references a SharedData. SharedMemoryByteSlice is used for data that the user types in manually. If the "userCount" of the shared data is 1, then the data is considered unshared and SharedMemoryByteSlice may modify that data directly. This is the principal mechanism by which simple modifications to the document's data, such as typing an additional character, do not require adding additional ByteArrayPieces to the ByteArray.

SharedMemoryByteSlice increments and decrements its SharedData "userCount" to indicate its reference to the SharedData. A userCount of 1 allows for an important "fast path" optimization which prevents cluttering the MyDocument's TavlTreeByteArray with additional ByteArrayPieces. The decrement of the userCount occurs within SharedMemoryByteSlice's dealloc method. Therefore, deterministic deallocation of SharedMemoryByteSlices is very important; take great care when autoreleaseing these objects.

The need for this fast path optimization is the principal barrier to supporting garbage collection within Hex Fiend, when Mac OS X supports that for Cocoa.

Retrieved from
Page last modified on May 03, 2007, at 07:18 PM