; Two 12-byte children of a 16-byte parent: limits may oversubscribe; the parent bounds the total. ; expect: run ; grant: heap=mem.alloc:16 ; result: 1 ; phase: 2 ; spec: docs/spec/03-memory-model.md module test.budget_children_compete air 0 lang 0.1 features [capabilities, effects, heap, ownership, resources] fn @main(%heap: cap) -> u8 effects [mem.alloc] entry: %twelve = const.usize 12 cap.narrow.budget %heap, %twelve, ok -> @a, err -> @bad a(%ca: cap): cap.narrow.budget %heap, %twelve, ok -> @b, err -> @bad2 b(%cb: cap): %v = const.u64 1 own.new %v, %ca, ok -> @x, err -> @nomem x(%ox: own): own.new %v, %cb, ok -> @y, err -> @nomem2 y(%oy: own): %small = const.u8 1 own.new %small, %cb, ok -> @z, err -> @parent_full z(%oz: own): trap parent_full(%e3: alloc_error): own.free %ox own.free %oy %one = const.u8 1 ret %one bad(%c1: cap_error): trap bad2(%c2: cap_error): trap nomem2(%e2: alloc_error): trap nomem(%e: alloc_error): trap