Skip to main content

Ownership, growth and allocation-failure contracts

This required 20–30-hour package replaces the former 2–3-hour growable-buffer lab. Allocate 6–8 hours to lessons and ownership traces, 9–14 to implementation and fault-injection evidence, and 5–8 to assessment and delayed repair. Original representation, pointer, layout and debugging practice remains required. See the reconciled semester workload.

Prerequisites and sequence​

Complete Module 1’s input-contract bridge and this module’s original allocation/pointer concepts. You need struct fields, callbacks, size_t and separate compilation. Keep the distinction between initialized length and available capacity explicit.

  1. Owner and borrow lifetimes.
  2. Failure-atomic growth.
  3. Size arithmetic.
  4. Prediction practice, runnable lab, and MP1–MP6 gates.

Resources and limits​

Read existing K&R pointer/allocation selections only as needed. Compare the lab with realloc in C11 draft N1570, section 7.22.3.5. Use Clang ASan and UBSan for the instrumented build. Sources checked on 2026-10-23; no purchase or book conversion required.

The original code is single-threaded, stores ints, and assumes valid initialized owners and allocator callbacks. It does not make arbitrary pointers safe, permit owner copying, or establish concurrency safety. The semester’s required fuzzing, Rust comparison, mitigation and specialized-execution strand remains separate; these checks do not replace it. Independent review and learner timing pilots remain pending.