Skip to content
Main site
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.

LimitThresholdPurpose
Identifier length255 bytesEliminates silent identifier truncation
Source file size8 MiBBounds frontend memory usage
Expression / statement depth128 / 64Prevents stack overflow
Parser live AST budget256 MiBProtects LSP and CLI processes
HTTP headers / body16 KiB / configurableDeterministic 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!");