(sigil bytes)

Borrowed byte ranges and bounded buffer reuse

A slice keeps its backing bytevector alive and never copies its bytes. Capacity describes writable storage; length describes valid packet data. New slices initially span their full capacity; pool acquisitions start empty.

A pool preallocates its buffers, root slices, leases and free-stack entries. Acquire/release reuse those objects and do not grow the pool. Exhaustion returns #f. Release does not erase bytes. Each acquisition has one owner: do not release while I/O is suspended or another fiber uses the storage. All slices derived from a pooled slice expire when it is released. Never retain or use them after release, even if that slot is acquired again.

Exports

%byte-leaseprocedure

Construct a %byte-lease struct.

%byte-lease?procedure

Test if a value is a %byte-lease struct.

Get the owner field of a %byte-lease struct.

Get the root field of a %byte-lease struct.

Get the views field of a %byte-lease struct.

Set the root field of a %byte-lease struct.

Set the views field of a %byte-lease struct.

Set the views field of a %byte-lease struct.

%byte-poolprocedure

Construct a %byte-pool struct.

%byte-pool?procedure

Test if a value is a %byte-pool struct.

Get the slices field of a %byte-pool struct.

Get the free field of a %byte-pool struct.

Get the available field of a %byte-pool struct.

Set the available field of a %byte-pool struct.

Borrow BUFFER[start,end), with an exclusive end. No bytes are copied.

Change valid data length without allocating a new view or clearing data.

Create an alias of valid data, inheriting its pool lease if present. Creating a pooled view also registers it for expiration at release. Reuse a view within its lease instead of slicing every packet.

Preallocate COUNT buffers, each with CAPACITY bytes. No automatic growth.

Return the same preallocated slice for this slot, or #f if exhausted.

Return only the acquired root slice, once, to its owning pool. Expire every derived view permanently, including nested views. Release visits those views; with none, acquire/release reuse only existing objects.

byte-slice?variable

(No description)

(No description)

(No description)

(No description)

(No description)

(No description)

(No description)

byte-pool?variable

(No description)

(No description)