Sigil 0.22.17

release

Sigil now manages its own memory allocator. Native programs built for static Linux x86_64 and C-to-WASM web builds use mimalloc 3.5.3 behind a new allocator interface, and the sigil command itself switches with them. Long-running programs hold much less memory, and web builds start smaller and grow less.

Download 0.22.17Get started

Existing projects build without changes. The first build after upgrading rebuilds each target's allocator once, because the allocator is now part of a build's cache identity.

Sigil manages its own allocator

Memory requests from Sigil's runtime and from bundled C code such as SQLite now go through one allocator interface that Sigil owns, instead of whatever the C library provides. On static Linux x86_64 builds and C-to-WASM web builds, that interface is backed by a pinned copy of mimalloc 3.5.3.

In our measurements, the allocator was the difference:

The shipped sigil command for Linux x86_64 is one of these static builds, so it uses mimalloc as well.

Web builds get tuned settings automatically

A default mimalloc reserves a large block of memory up front, which on the web made things worse, not better. C-to-WASM builds therefore get three compile-time settings automatically: MI_FREE_USE_PAGEMAP=1, MI_DEFAULT_ARENA_RESERVE=4096 and MI_ARENA_SLICE_SHIFT=14. They're upstream's own options, and the first is upstream's recommendation for WASI. You don't need to set anything.

Choosing the allocator

To keep the previous allocator for a build, add the allocator-stock feature:

(build
  name: 'web-stock
  target: "wasm32-wasi"
  features: '(release allocator-stock))

allocator-mimalloc requests mimalloc explicitly, and fails on a target where it isn't qualified yet. WASI builds can also pass typed MI_* settings; unknown names are rejected. Details are in the allocator guide.

The new sigil-allocator export from (sigil meta) reports which allocator a running program uses.

What stays the same