Entities · interface

AllocatorSnapshot

An allocator's whole position, for a rewind.

Explained in Entities.

interface AllocatorSnapshot
import type { AllocatorSnapshot } from '@driftengine/entities';

In depth

Reused between saves rather than made per save. A rollback loop takes one of these sixty times a second, so the arrays are grown to the allocator's own capacity once and then written over; the fields are mutable for that reason and not because a caller should touch them.

The free queue is held as a count and a typed array instead of the number[] the allocator keeps, so a save is a memcpy. Its order is part of the state, not an incidental detail: the queue is first-in-first-out precisely so slot wear spreads, and restoring the same slots in a different order hands out different handles on the next create.

Properties

NameTypeDescription
generationsUint32Array
liveUint8Array
freeInt32Array
freeCountnumber
highWaternumber
aliveCountnumber