Skip to main content

Module guard

Module guard 

Source
Expand description

Constant-memory size guards for the read paths.

A pathological result — one 512 MB bytea/TEXT cell, an unexpectedly wide row, or a huge table the CLI tries to buffer whole for table rendering — can OOM-kill the process. These guards turn that into a clean, bounded failure: each cell and row is measured against a cap before it is retained, and the eager query path keeps a running byte tally so it aborts long before an unbounded Vec<Row> exhausts memory.

Constant-memory by construction. This is deliberately not an RSS-accounting budget. Value::byte_size is a cheap monotonic proxy; the guards are coarse ceilings checked incrementally so the checker itself never allocates proportional to the data it inspects. A 0 cap means “unlimited” for that dimension.

Structs§

SizeGuards
Per-connection size ceilings applied to every read.