Bounded streams and retained foreign references¶
Actual SDK IBStream objects own fixed storage. Cursor/data methods admit only
the original main thread during their synchronous phase. They validate signed
seek arithmetic, sizes, optional output pointers and known aliases before effects;
capture gaps are zeroed and short EOF reads report their actual byte count.
Streams freeze on every foreign return or exception. Frozen streams reject
cursor/data access. QueryInterface and reference counting remain available
across threads and after freeze; selector/output alignment and known aliases are
validated before output writes without changing a completed stream diagnostic.
The native core keeps a host reference before passing streams to foreign code. Per-core budgets are 16 streams and 64 MiB; each stream is at most 8 MiB. All leases for a transaction are reserved before foreign calls. A foreign worker's last release leaves that host reference, so payload destruction occurs later on control. Host-only frozen streams are reclaimed on the next control state operation.
A retained foreign stream forces process pinning through the core's existing
reserved registry slot, including retention after rejected or throwing getters.
Last parent-facade retirement consumes ProcessPinned; module, factory, context,
host and keeper ownership survive until OS process exit. Reopening a known v2
path/alias uses that same core; v1 cannot adopt it. Releasing all foreign streams
later permits control payload reclamation but does not unpin the module. Provider
executable and callback code must also remain loaded through process exit. There
is no static-exit destruction or promised whole-plugin heap/RSS bound.