Skip to content
odinlinterstatic-analysisperformance

olint

A static linter for Odin that follows the call graph: @zero_alloc and @no_temp_alloc guarantees, temp allocator discipline, package layers and large value copies, without compiling the project.

since November 20260Odinpushed 28 days ago

olint

olint reads an Odin project with core:odin/parser, builds its call graph and package import graph, and checks what the code promises: @zero_alloc and @no_temp_alloc, how context.temp_allocator is used, which packages may import which, and large values copied by accident. It never compiles or runs the project, and it uses only base: and core: packages.

It's the static half of obench. obench checks @zero_alloc at runtime on the inputs a benchmark runs, and olint checks the same annotation on every call path it can resolve.

Install

olint needs Odin dev-2026-10 or newer. Build the CLI from a clone, or take a prebuilt one from a release:

odin build cmd/olint -out:bin/olint -o:speed

A finding

Run it on any Odin project, with no imports or changes to the source:

./bin/olint path/to/project

Mark a hot-path procedure with // @zero_alloc, or pass -e <proc>. When it reaches an allocation several calls deep, across packages, olint prints the shortest call chain from the procedure to the allocating call. olint examples/game_loop -e step_world_leaky on an Apple M2:

olint: game_loop (darwin/arm64, 2 package(s), 2 file(s), 6 proc(s) analyzed in 1.99 ms)
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────
rule             │ severity │ location          │ finding
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────
alloc/zero-alloc │ ERROR    │ sim/sim.odin:35:1 │ sim.step_world_leaky (@zero_alloc) allocates on context.allocator
   ├─► sim.step_world_leaky (sim/sim.odin:37:2) ── calls physics.solve_contacts_debug
   ├─► physics.solve_contacts_debug (physics/physics.odin:30:10) ── calls physics.format_contact_tag
   ╰─► physics.format_contact_tag (physics/physics.odin:36:9) ── calls fmt.aprintf (heap string formatting [heap: context.allocator])
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────
FAIL: 1 error(s), 0 warning(s), 0 parse error(s) across 2 package(s)

Allocations follow context. If the caller sets context.allocator = mem.arena_allocator(&arena) before the call, the callee's make goes to the arena and isn't reported. olint rules lists the built-in rules.

olint is before 1.0, so the API and the JSON report can still change, and the release notes list every breaking change. It's under the BSD-3-Clause licence.

latest on main

  1. 1cd60d0ci: skip release-please compare links in the link check (#3)28 days ago
  2. c156622chore(main): release 0.1.0 (#2)28 days ago
  3. 38cf155fix: resolve imports between in-memory packages on Windows (#1)28 days ago
  4. e6619c6feat: static call-graph allocation, architecture, and performance linter for Odin28 days ago
  5. all commits →