ancatrusca

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.

Where Next?

Popular in Blog Posts Top

gaggle
This post explores different ways to do test automation in Elixir, focusing on how to handle dependency injection — covering patterns, li...
New
brainlid
Elixir has a built-in Zip library that comes with OTP. This post explores how to use the zip module and asks the important question: “Is ...
New
brainlid
I love LiveView. Navigating between views is so fast! This quick tip makes navigating feel instantaneous by adding a split-second delay b...
New
ConnorRigby
Just finished a post for Embedded Elixir and I thought it should be cross-posted here: https://embedded-elixir.com/post/2018-09-25-mocks...
New
adolfont
Hi, You all probably know that José Valim is Brazilian and that his native language is Portuguese. I, Herminio Torres, Matheus Pesanha a...
New
pillaiindu
Our very handsome and humble José Valim (@josevalim) just published Kubernetes and the Erlang VM: orchestration on the large and the sma...
New
rlopzc
Use the new log handlers to plug Slack or any other provider into your logging system. https://rlopzc.com/posts/integrate-slack-into-the...
New
mssantosdev
This post is a guide on how Norba and I are building LiveMatch, a real-time app for soccer to follow multiple games in one place. https:...
New
John-BoothIQ
TL;DR: Good: AI is great at Elixir. It gets better as your codebase grows. Bad: It defaults to defensive, imperative code. You need...
New
bemesa21
Add drag-and-drop functionality to your Phoenix LiveView app with SortableJS and LiveView Hooks! This posts shows you how to create an in...
New

Other popular topics Top

electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
johnnyicon
Hi all, I’ve just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I’m trying to use Postgres...
New
chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
aesmail
Hello guys, I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the curre...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New

We're in Beta

About us Mission Statement