LeanLmdb.Codecs.ErlangTerm (lean_lmdb v0.3.0)

View Source

Deterministic codec for safe, data-only Erlang terms.

The codec accepts numbers, atoms already present in the runtime, binaries, bitstrings, lists, tuples, and maps composed recursively from those types. Functions, PIDs, ports, references, and other executable/runtime resources are rejected. Decoding uses :safe external-term semantics and never creates new atoms.

:max_bytes defaults to 8 MiB and bounds both the encoded payload and input accepted by the decoder (the configurable maximum is 64 MiB). Compressed external terms are rejected before decoding to prevent decompression bombs. This is an encoded-size bound, not an exact BEAM heap-size measurement; applications should select a materially smaller limit than their process memory budget. Custom compression codecs must enforce independent encoded and decoded-size bounds before allocating expanded output.