finds.dev

cloudwu/lua-snapshot

Make a snapshot for lua state to detect memory leaks.

View on GitHub

★ 531CMITupdated Aug 2024

// the take

A C extension for Lua that snapshots the entire Lua state — every live object and its reference graph — so you can diff two snapshots and find what leaked between them. Aimed at game developers and server engineers running long-lived LuaJIT/Lua 5.x processes where memory growth is otherwise opaque.

The diffing approach is genuinely useful: take a snapshot before and after a suspected leak window, compare, and get exactly what's alive that wasn't before. The C implementation means it can walk the full GC graph including weak tables and upvalues that Lua-side introspection can't reach. cloudwu is the author of skynet, so this comes from real production use in high-throughput Lua server environments, not a toy. Single-file C with a Makefile — trivial to audit and embed.

The README is essentially empty; you're reading dump.lua to understand how to actually use it. No documentation on what the output format means or how to interpret the diff in non-obvious cases (cycles, weak references). No test suite at all. The last meaningful commit was years ago, and it only targets Lua 5.3/5.4 — LuaJIT compatibility is unconfirmed and likely requires patching. For anything beyond the happy path you're on your own.

We read the README, the directory tree and a key source file in June 2026. Nobody pays to be listed. How we judge →

// at a glance

Stars
531
Forks
203
Language
C
License
MIT
Last commit
5 Aug 2024

// nearby

If lua-snapshot isn't quite it.

All repos →