Memory Safety in C SSG Without Rust
Patterns we use to avoid leaks and segfaults in CAX: arenas, object pools, and strict free ownership.
Is C Unsafe? Only If You Code Unsafe.
Our rules:
- Every `cax_object_new()` has `cax_object_free()` in same scope
- No global state - pass
CAXObject *ctx - Copy, don't reference -
copy_all()for context
CAXObject *ctx = cax_object_new();
copy_all(global_data, ctx);
copy_all(ctrl, ctx);
// use
cax_object_free(ctx);
We run valgrind on every build:
==123== All heap blocks were freed -- no leaks are possible
C can be safe. You just need discipline.