| 1 | module VecFull; |
| 2 | (* a Vec whose allocator runs out stops the program, with the calls |
| 3 | under way, rather than dropping what it was given *) |
| 4 | import Arena, Rt, Ints := Vec(INT); |
| 5 | import SYSTEM; |
| 6 | |
| 7 | proc main*; |
| 8 | var ar: Arena.Arena; v: Ints.Vec; i: INT; |
| 9 | begin |
| 10 | if not Arena.init(ar, 4096) then Rt.stop("no arena"); end; |
| 11 | Ints.init(v, SYSTEM.ADR(ar.base)); |
| 12 | for i := 1 to 10000 do Ints.push(v, i); end; |
| 13 | end; |
| 14 | |
| 15 | end VecFull. |