You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Reduce/eliminate steady-state heap allocations in sendspin-cpp #92
Sendspin/sendspin-cpp#220 identified a runtime failure due to a failed heap allocation in sendspin-cpp. Sendspin/sendspin-cpp#222 fixed that particular allocation, but there are still a lot more heap allocations that can cause hard failures during the connection/reconnection process.
Currently, 63 heap allocations occur when a new connection starts up. The goal is to reduce/eliminate these as much as possible to avoid heap churn giving better long-term stability.
After this list, only 5 heap allocations occur with a new connection/reconnection/pairing. Those are more challenging to eliminate, so I will think over the best approach more. There are no heap allocations in a steady run state; i.e., one active connection streaming.
changed the title [-]Reduce/eliminate heap allocations in sendspin-cpp[/-][+]Reduce/eliminate steady-state heap allocations in sendspin-cpp[/+]on Nov 3, 2026
A coherence review after these changes found some drift between the migrated pieces, plus peer data that is still copied unbounded or allocated per message:
Activity
kahrendt commentedon Nov 3, 2026
Eliminating the remaining allocations:
std::stringonly when a user calls the getter Hold the server's id and name inline sendspin-cpp#233[ ] Individual connection objects on esp32 platforms (Untracked by repo's test)tracking repeated/handled in Reduce/eliminate steady-state heap allocations in sendspin-cpp #92 (comment)[-]Reduce/eliminate heap allocations in sendspin-cpp[/-][+]Reduce/eliminate steady-state heap allocations in sendspin-cpp[/+]kahrendt commentedon Nov 3, 2026
A coherence review after these changes found some drift between the migrated pieces, plus peer data that is still copied unbounded or allocated per message:
extract()guard, naming Tidy the drift the allocation series left behind sendspin-cpp#235server/errorreason as an enum,psk_categoryand pairing fields decoded in place, msg1 size cap Bound the peer text read before authentication sendspin-cpp#236conventions.md,internals.mdandCLAUDE.mdWrite down the allocation model sendspin-cpp#237client/stateartwork channels and visualizer types as views/inline sets; extend the allocation test to the artwork and visualizer roles View client/state's artwork channels and visualizer types sendspin-cpp#240stream/*messages: role lists, codec header copies (player and source), artwork channel cap, FLAC decoder reset instead of a new decoder per header Hold the stream/* messages' bounded fields inline sendspin-cpp#241[ ] Breaking public API changes:covered by tracking in Reduce/eliminate steady-state heap allocations in sendspin-cpp #92 (comment)group/updateas views (group_idas a 43-character id needs Definegroup_idas a 43-character base64url value spec#340), visualizer types as a set[ ] Connection pool and slot array on esp32, plus the pending/closing lists; same as the esp32 item above (Untracked by repo's test)tracking is repeated/handled in Reduce/eliminate steady-state heap allocations in sendspin-cpp #92 (comment)Write down the allocation model (#237)
Keep the pairing builders, notes and PSK minting off the aborting heap (
View client/state's artwork channels and visualizer types (#240)
Hold the stream/* messages' bounded fields inline (#241)
Gate stream/start's sections before parsing them (#242)
Bound logged peer text and reject a non-array active_roles (#244)
Share the fixed-size vocabulary across its sibling sites (#245)
Hold the ESP accept path's sessions in fixed storage (#246)
Draw random bytes through noise-c's stack generator (#247)
2 remaining items
Advertise application-specific roles and support objects in client/he…
Decode the FLAC codec_header at parse into a fixed 42-byte array (#250)
Keep the pairing record store's writes and new records off the heap (#…
Run the pairing exchange without heap allocation (#253)
Open connect_to's connection without operator new or URL copies (#254)
Make first-use allocations fail gracefully and admit only the request…
Hold group/update's fields inline and normalize a non-conforming grou…
Hold metadata text in three fixed blocks and let consumers choose its…
Hand metadata and group text to consumers as string_view (#260)
Hand pairing text, tokens and server information to consumers without…
Order visualizer stream callbacks against frames and hand spectrum bi…
Hand the player's PCM with its format on every write (#268)
kahrendt commentedon Nov 19, 2026
https://github.com/Sendspin/sendspin-cpp/releases/tag/v0.10.0 is now out with all these changes. There should be no heap allocations after setup and first audio playback.