Skip to content

refactor(fspy-shared): make the channel allocator-generic - #673

Draft
wan9chi wants to merge 1 commit into
agent/fspy-pooled-bump-renamefrom
agent/fspy-alloc-generic-channel
Draft

refactor(fspy-shared): make the channel allocator-generic#673
wan9chi wants to merge 1 commit into
agent/fspy-pooled-bump-renamefrom
agent/fspy-alloc-generic-channel

Conversation

@wan9chi

@wan9chi wan9chi commented Aug 14, 2026

Copy link
Copy Markdown
Member

Motivation

The end goal is a fully std-free preload, and fspy_shared hardcoding its allocators stands in the way: channel() built its C strings with the global allocator, and sender() reached for a pooled bump internally — an infrastructure crate deciding what memory its callers should use.

channel(), Receiver, and sender() are now generic over an allocator-api2 allocator. The supervisor instantiates with Global; on the preload side the allocator is passed down from the top of the call stack — Client::from_env and Client::from_payload_bytes accept it, and the preload ctor / DllMain pass a pooled bump — so the choice of preload-safe memory lives where the attach begins, not inside library code. This also sets up the payload-view PR on top, where the allocator the client borrows becomes load-bearing for payload lifetimes.

🤖 Generated with Claude Code

@wan9chi wan9chi changed the title agent/fspy alloc generic channel refactor(fspy-shared): make the channel allocator-generic Aug 14, 2026
@github-actions

github-actions Bot commented Aug 14, 2026

Copy link
Copy Markdown

fspy benchmark

linux

dynamic/launch             change  +0.10%  [-12.24% .. +11.22%]  overhead  +256.20%
dynamic/access             change  +0.67%  [ -0.94% ..  +2.21%]  overhead    +6.52%
dynamic/access-relative    change  -0.35%  [ -1.62% ..  +1.32%]  overhead   +55.83%
dynamic/access-contended   change  +2.08%  [ -0.78% ..  +5.09%]  overhead    +9.77%
static/launch              change  +0.66%  [ -7.94% ..  +8.44%]  overhead  +680.17%
static/access              change  -0.19%  [ -1.49% ..  +1.79%]  overhead  +726.24%
static/access-relative     change  +0.16%  [ -1.33% ..  +1.49%]  overhead +1161.60%
static/access-contended    change  +0.36%  [ -2.00% ..  +2.22%]  overhead +3178.64%

macos

dynamic/launch             change  +0.58%  [ -5.71% ..  +6.66%]  overhead  +240.85%
dynamic/access             change  -0.34%  [-60.33% .. +16.97%]  overhead    +4.20%
dynamic/access-relative    change  +0.65%  [ -5.20% .. +11.99%]  overhead  +241.76%
dynamic/access-contended   change  +1.81%  [-15.53% .. +736.75%]  overhead    +2.31%

windows

dynamic/launch             change  -1.39%  [ -8.53% ..  +6.88%]  overhead   +25.04%
dynamic/access             change  +0.24%  [-18.05% .. +11.79%]  overhead    +1.23%
dynamic/access-relative    change  -0.34%  [ -7.52% ..  +7.65%]  overhead    +1.88%
dynamic/access-contended   change  +0.21%  [ -4.74% ..  +5.45%]  overhead    +3.45%

@wan9chi
wan9chi force-pushed the agent/fspy-alloc-generic-channel branch from e67af66 to a1a77c5 Compare August 14, 2026 08:04
@wan9chi
wan9chi force-pushed the agent/fspy-alloc-generic-channel branch from a1a77c5 to 7ff65af Compare August 18, 2026 03:43
channel(), Receiver, and sender() are now generic over an
allocator-api2 allocator instead of hardcoding the global allocator and
an internal pooled bump:

- channel() threads the caller's allocator through the shared-memory
  backing path and the ShmKeeper; the supervisor instantiates with
  Global.
- sender() takes the allocator for its transient shm-path decode from
  the caller, and the client constructors pass it through from the top
  of the call stack — the preload ctor and DllMain — so the choice of
  preload-safe memory lives where the attach begins, not inside
  library code.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@wan9chi
wan9chi force-pushed the agent/fspy-alloc-generic-channel branch from 7ff65af to d362c5f Compare August 18, 2026 09:13
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