Slab is a simple storage mechanism for Java objects.
Ideas borrowed from Martin Thompson blog and Richard Warburton slab project.
Unlike references above, this slab's emphasis is on providing a simple Collection-like behaviour to a huge number of objects (> Integer.MAX_VALUE) with reasonable performance, flexible storage abstraction and memory efficient management.
The only limitation it sets on the stored Java object is that its seralized content size must be fixed and known in advance.
The main features in slab are:
- Basic Collection operations (
add
,get
,remove
,iterator
,size
) that work on long keys (Slab maximum size isLong.MAX_VALUE
). - Abstraction of the underlying storage and its access. (No need to commit to either memory type, serialization protocol etc.)
- Management of free gaps in the slab (that are created by removals) and efficient filling of those gaps to avoid fragmentation.
- Using the Flyweight pattern to access data inside the slab.
- Compaction of the slab to reduce consumed memory.
- Ability to control the addresses returned and abstraction of a virtual addressing scheme.