Skip to content

Make the pcap load memory budget configurable with --pcap-memory - #6

Merged
atoonk merged 1 commit into
mainfrom
pcap-memory
Aug 11, 2026
Merged

atoonk merged 1 commit into
mainfrom
pcap-memory

Conversation

@atoonk

@atoonk atoonk commented Aug 11, 2026

Copy link
Copy Markdown
Owner

Replaying a capture holds the whole file in memory, and two hardcoded caps bounded that: 1 GiB of loaded bytes and two million packets. Anyone with a big server and a bigger capture hit a wall with no knob to turn.

The two caps are now one honest budget, raised with --pcap-memory: it counts frame bytes plus the 24-byte-per-record index, so it bounds actual memory and the separate packet cap falls out as redundant. Sizes parse in binary units (1G is 1<<30), deliberately unlike the decimal rate flags, because the old default was 1<<30 and a decimal 1G would have quietly shrunk it. The default stays 1 GiB.

Record offsets widen to uint64 so budgets past 4 GiB actually work. Loading also got cheaper: the backing store is preallocated from the file size instead of doubling through append regrowth, and reads go through pcapgo's zero-copy path instead of allocating a buffer per packet. Peak RSS loading a 1.06 GiB capture drops from 2.19 GiB to 1.17 GiB, and a 5.3 GB capture loads in three seconds.

The budget persists across runs like the rate limits do, and the wizard gets a matching field.

related to issue #3

Replaying a capture holds the whole file in memory, and two hardcoded
caps bounded that: 1 GiB of loaded bytes and two million packets.
Anyone with a big server and a bigger capture hit a wall with no knob
to turn.

The two caps are now one honest budget, raised with --pcap-memory: it
counts frame bytes plus the 24-byte-per-record index, so it bounds
actual memory and the separate packet cap falls out as redundant.
Sizes parse in binary units (1G is 1<<30), deliberately unlike the
decimal rate flags, because the old default was 1<<30 and a decimal 1G
would have quietly shrunk it. The default stays 1 GiB.

Record offsets widen to uint64 so budgets past 4 GiB actually work.
Loading also got cheaper: the backing store is preallocated from the
file size instead of doubling through append regrowth, and reads go
through pcapgo's zero-copy path instead of allocating a buffer per
packet. Peak RSS loading a 1.06 GiB capture drops from 2.19 GiB to
1.17 GiB, and a 5.3 GB capture loads in three seconds.

The budget persists across runs like the rate limits do, and the
wizard gets a matching field.

related to issue #3
@atoonk
atoonk merged commit da55cdb into main Aug 11, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant