(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-leaseprocedureConstruct a %byte-lease struct.
%byte-lease?procedureTest if a value is a %byte-lease struct.
%byte-lease-ownerprocedureGet the owner field of a %byte-lease struct.
%byte-lease-rootprocedureGet the root field of a %byte-lease struct.
%byte-lease-viewsprocedureGet the views field of a %byte-lease struct.
set-%byte-lease-root!procedureSet the root field of a %byte-lease struct.
set-%byte-lease-views!procedureSet the views field of a %byte-lease struct.
%%byte-pool--typevariableSet the views field of a %byte-lease struct.
%byte-poolprocedureConstruct a %byte-pool struct.
%byte-pool?procedureTest if a value is a %byte-pool struct.
%byte-pool-slicesprocedureGet the slices field of a %byte-pool struct.
%byte-pool-freeprocedureGet the free field of a %byte-pool struct.
%byte-pool-availableprocedureGet the available field of a %byte-pool struct.
set-%byte-pool-available!procedureSet the available field of a %byte-pool struct.
make-byte-sliceprocedureBorrow BUFFER[start,end), with an exclusive end. No bytes are copied.
byte-slice-set-length!procedureChange valid data length without allocating a new view or clearing data.
byte-slice-subsliceprocedureCreate 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.
make-byte-poolprocedurePreallocate COUNT buffers, each with CAPACITY bytes. No automatic growth.
byte-pool-acquire!procedureReturn the same preallocated slice for this slot, or #f if exhausted.
byte-pool-release!procedureReturn 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)
byte-slice-buffervariable(No description)
byte-slice-startvariable(No description)
byte-slice-capacityvariable(No description)
byte-slice-lengthvariable(No description)
byte-slice-refvariable(No description)
byte-slice-set!variable(No description)
byte-pool?variable(No description)
byte-pool-availablevariable(No description)