It's a variant on reference counting (and, like reference counting, doesn't handle cycles). It works like this:
- Pointers, in addition to pointing to the memory location, participate in a doubly linked ring of all pointers to that memory location. Thus the name "Fat Pointers". The memory location itself also participates in this ring.
- Memory is deallocated when the last pointer to that memory is deleted. We detect this using the pointer ring.
- Memory is always allocated after the last allocated block.
- Allocated memory stores a pointer to the previous and next allocated block (another ring structure). This is traversed by a background memory compaction process that moves allocated memory toward the bottom of the heap. When a chunk of memory is moved we use the pointer ring to update all pointers to it.
Some nice features:
- No need to "stop the world" to garbage collect or memory compact, a plus in realtime applications.
- Memory fragmentation is constantly being reduced. Good where memory is limited. Good also for disk based databases, the file can be made shorter by compaction.
- You can store other things besides a pointer in a Fat Pointer. An integer or double, for example.