# Loki::Chunk Struct Reference
[Internals]

List of all members.

## Detailed Description

Contains info about each allocated Chunk - which is a collection of contiguous blocks. Each block is the same size, as specified by the FixedAllocator. The number of blocks in a Chunk depends upon page size. This is a POD-style struct with value-semantics. All functions and data are private so that they can not be changed by anything other than the FixedAllocator which owns the Chunk.

Minimal Interface
  For the sake of runtime efficiency, no constructor, destructor, or copy-assignment operator is defined. The inline functions made by the compiler should be sufficient, and perhaps faster than hand-crafted functions. The lack of these functions allows vector to create and copy Chunks as needed without overhead. The Init and Release functions do what the default constructor and destructor would do. A Chunk is not in a usable state after it is constructed and before calling Init. Nor is a Chunk usable after Release is called, but before the destructor.

Efficiency
  Down near the lowest level of the allocator, runtime efficiencies trump almost all other considerations. Each function does the minimum required of it. All functions should execute in constant time to prevent higher- level code from unwittingly using a version of Shlemiel the Painter's Algorithm.

Stealth Indexes
  The first char of each empty block contains the index of the next empty block. These stealth indexes form a singly-linked list within the blocks. A Chunk is corrupt if this singly-linked list has a loop or is shorter than blocksAvailable_. Much of the allocator's time and space efficiency comes from how these stealth indexes are implemented.

The documentation for this struct was generated from the following file:

- SmallObj.cpp