Skip to content

Callback arena - #6

Merged
borkdude merged 4 commits into
mainfrom
callback-arena
Aug 29, 2026
Merged

Callback arena#6
borkdude merged 4 commits into
mainfrom
callback-arena

Conversation

@borkdude

Copy link
Copy Markdown
Contributor

No description provided.

babashka.ffi/callback takes an arena now, and free-callback is gone. A
connection carries a shared arena instead of a vector of callback pointers:
sqlite calls a registered function on whichever thread runs the statement,
so the arena cannot be confined, and close! releases every callback in one
operation.

This removes the bookkeeping that could drift. A callback could not be
registered without ending up in the arena, where a callback could be
created and never pushed onto :fns.

The ffi dependency points at the callback-arena branch. Re-pin it to the
merge commit.
Each registered function gets its own arena. When sqlite3_create_function
refuses the registration, sqlite never took the callbacks, so that arena
closes right there instead of leaving the stubs until close!. A retry loop
against a failing registration no longer accumulates them.

close! closes whatever registrations succeeded.
The test assumed an argument count of 200 was always rejected. winsqlite3 is
built with a higher SQLITE_MAX_FUNCTION_ARG and accepts it, so the Windows
job saw no exception. The test now finds a registration that this build does
refuse, preferring the 255-byte limit on a function name, which is a constant
in sqlite's core rather than a compile-time setting.
@borkdude
borkdude merged commit f54228b into main Aug 29, 2026
6 checks passed
@borkdude
borkdude deleted the callback-arena branch August 29, 2026 09:23
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