WAD Lumps and Zone Memory

WAD Lumps and Zone Memory

Doom’s data model is organized around WAD files and named lumps, not a modern hierarchy of individually loaded assets. w_wad.c and w_wad.h build the directory of lump metadata, provide name and number lookup, and expose the cache operations used by rendering, level setup, sounds, and menus.

WAD directory entries resolving to cached lump data

A lump is deliberately generic. It may contain a map block, texture definition, palette, sprite, sound, or some other typed resource; the consuming subsystem determines the interpretation. This is why source traces should pair a W_CacheLump... call with the reader that casts or parses the returned bytes rather than assuming that the cache layer knows the semantic type.

Zone allocation

z_zone.c and z_zone.h provide Doom’s zone allocator. The zone records allocation tags and supports purgeable cached data, allowing resource ownership and eviction policy to be expressed through the allocator interface rather than by a separate general-purpose asset manager. WAD caching and zone memory therefore form one design: lump directory lookup identifies data, while tagged allocation controls its residency.

The arrangement is strongly shaped by the original memory environment. It is still a useful lesson in explicit resource lifetimes: consumers obtain data through a stable index or name, cached blocks carry category information, and systems do not need to know the physical file layout once initialization has built the lump directory.