Memory Model & SafetyM3
Resource Cleanup & Frontend Budgets
Deterministic cleanup of sockets, files, and SQLite handles on abort, plus explicit compiler budgets.
5 min readUpdated: v0.8.0-rc Reference
Centralized Resource Registry (Decision 0024)
Listening sockets, accepted client sockets, file descriptors, and SQLite handles are registered with the active execution context. On both normal exit and runtime abort (assert, overflow, OOM), all external resources are closed deterministically—verified under ASan/UBSan with open-fd counts returning to baseline.
| Limit | Threshold | Purpose |
|---|---|---|
| Identifier length | 255 bytes | Eliminates silent identifier truncation |
| Source file size | 8 MiB | Bounds frontend memory usage |
| Expression / statement depth | 128 / 64 | Prevents stack overflow |
| Parser live AST budget | 256 MiB | Protects LSP and CLI processes |
| HTTP headers / body | 16 KiB / configurable | Deterministic 431 and 413 responses |
hadid · EN
fn valid_age(age: i32): bool { if (age < 0) { return false; } if (age > 150) { return false; } return true;}assert(valid_age(28), "valid age must pass");assert(valid_age(-1) == false, "negative age must fail");print("All contracts verified!");