ancatrusca
BEAM There, Done That with Garrison Hinson-Hasty & Isaac Yonemoto on Safer Native Code
Sharing the latest BEAM There, Done That episode, which covers Zig and Zigler in more practical depth than I’ve seen in one place before.
Key things for the Elixir side of the community:
The BEAM allocator integration. Zigler uses the BEAM’s allocator by default. This means native memory is visible to Erlang’s VM monitoring, unlike raw C NIFs or Rustler NIFs that use their own allocators. In practice this makes native memory usage observable from your Elixir telemetry, which is a meaningful operational improvement.
The four scheduler modes. Normal, dirty CPU, dirty IO, and spawned thread - switchable per function with a single flag, no Zig code changes required. The episode walks through when to use each.
What Zig actually catches. Spatial memory safety: buffer overflows, out-of-bounds array accesses, null pointer dereferences are caught in safe release mode and produce panics rather than silent corruption. What it doesn’t catch: temporal memory safety (use-after-free). A Zigler NIF can still crash the node if you hit that class of bug.
The marshalling story. Zigler generates boxing/unboxing code at function boundaries automatically. Type mismatches produce clear argument errors rather than crashes. The function name is the same in Zig and Elixir with no name transformations, which helps a lot when searching across a mixed codebase.
Isaac also showed a live demo of the sigil syntax - ~Z"“” … “”" with use Zig - which is the cleanest interface to NIF code I’ve seen for Elixir.
Would be good to hear from anyone who’s shipped this in production.
Popular in Blog Posts
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #hex









