nupp.mem

C storage and the checked views over it.

Allocation, layout, and the bounds-carrying views that make a raw pointer safe to index. Every member is a module of its own, reached by the name it has: nupp.mem.span for borrowed views over rooted storage, nupp.mem.array for owned contiguous arrays on native and Wasm targets, nupp.mem.heap for owned malloc-backed arrays, nupp.mem.soa for structure-of-arrays storage, and nupp.mem.indexed for the one inclusive range they all validate against. Two allocators hand storage out and take it back rather than viewing it: nupp.mem.arena leases zero-filled struct rows from pages that never move, and nupp.mem.pool leases cleared record instances, which are ordinary tables and so the one member here that needs no C storage at all.

Nothing is re-exported here. A view knows its element count, and every index and slice is checked against it before the only unsafe pointer arithmetic in the standard library.

See c-interop.md for what crossing the C boundary costs, and ownership.md for the borrow rules the views are written against.

Submodules

ModuleDescription
nupp.mem.arenaA paged allocator of struct rows whose pages never move.
nupp.mem.arrayOwned contiguous arrays.
nupp.mem.heapOwned, malloc-backed C arrays.
nupp.mem.indexedOne inclusive range, checked once against every view a loop is about to index.
nupp.mem.poolA pool of record instances of one declared type.
nupp.mem.sharedbytesEngine-owned immutable byte regions.
nupp.mem.soaStructure-of-arrays storage for reified structs.
nupp.mem.spannupp.mem.span gives a C array a rooted, one-based, bounds-checked view.