Show HN: LibTTAK- Explicit lifetime-as-data for C systems (github.com)

3 points by gg582 ↗ HN
LibTTAK is a C systems collection that moves lifetime management from control flow logic into the data model.

In traditional C, memory safety relies on the programmer correctly ordering `free()` calls. Even in C++ or Rust, while RAII and ownership rules automate this, the logic still lives in the control flow. LibTTAK encodes the lifetime directly into the allocation.

Key features:

Lifetime as data: Every allocation has an explicit expiry.

Access validation: `ttak_mem_access(ptr, tick)` enforces expiry checks at the data level.

Minimalistic cleanup: No GC, but automatically frees memory with an interval, which can be turned off. Also, the user can manually clean up targeted pointers.

Operational coupling: Simplifies staged shutdowns and subsystem boundaries by grouping allocations under a single lifetime.

The goal is to provide the safety of deterministic cleanup without the overhead of a garbage collector or the complexity of complex ownership tracking.

Docs: https://gg582.github.io/libttak

1 comment

[ 3.6 ms ] story [ 14.7 ms ] thread
Honestly, in many systems projects it is often simpler and safer to minimize or even avoid malloc entirely: rely more on stack, static buffers, or simple arenas. This usually leads to fewer bugs and more predictable behavior than building complex lifetime systems on top of the heap.