Skip to content

Harden mruby value lifecycle - #94

Merged
jackalcooper merged 1 commit into
agent/mruby-stack-01-runtimefrom
agent/mruby-stack-02-lifecycle
Aug 12, 2026
Merged

Harden mruby value lifecycle#94
jackalcooper merged 1 commit into
agent/mruby-stack-01-runtimefrom
agent/mruby-stack-02-lifecycle

Conversation

@jackalcooper

Copy link
Copy Markdown
Contributor

What changed

  • add isolated VM and rooted Value resources
  • retain the parent VM from child values and defer VM destruction until children close
  • use mruby GC register/unregister and arena discipline
  • contain Ruby exceptions with mrb_protect_error
  • stress explicit close and arbitrary BEAM GC ordering

Why

mruby values belong to exactly one mrb_state; the resource graph now makes that ownership explicit and prevents use-after-free regardless of parent/child collection order.

Validation

  • MIX_ENV=test mix compile --force --warnings-as-errors
  • mix credo --strict
  • mix test --force (6 tests)

Stacked on #93.

@jackalcooper
jackalcooper force-pushed the agent/mruby-stack-02-lifecycle branch from c396cfa to f3e31f3 Compare August 12, 2026 08:47
@jackalcooper
jackalcooper force-pushed the agent/mruby-stack-02-lifecycle branch from f3e31f3 to 9c302f1 Compare August 12, 2026 08:51
@jackalcooper
jackalcooper force-pushed the agent/mruby-stack-02-lifecycle branch from 9c302f1 to 2d7e9f9 Compare August 12, 2026 08:54
@jackalcooper
jackalcooper force-pushed the agent/mruby-stack-02-lifecycle branch from 2d7e9f9 to 53c133f Compare August 12, 2026 09:07
@jackalcooper
jackalcooper force-pushed the agent/mruby-stack-02-lifecycle branch from 53c133f to 369f3b7 Compare August 12, 2026 09:11
@jackalcooper
jackalcooper force-pushed the agent/mruby-stack-02-lifecycle branch 2 times, most recently from 3c495f2 to fa80277 Compare August 12, 2026 09:23
@jackalcooper
jackalcooper force-pushed the agent/mruby-stack-02-lifecycle branch from fa80277 to 40ab1e6 Compare August 12, 2026 09:28
@jackalcooper
jackalcooper force-pushed the agent/mruby-stack-02-lifecycle branch from 40ab1e6 to a49696d Compare August 12, 2026 09:35
@jackalcooper
jackalcooper force-pushed the agent/mruby-stack-02-lifecycle branch 2 times, most recently from 96a90ea to 79c2bb6 Compare August 12, 2026 09:48
@jackalcooper
jackalcooper force-pushed the agent/mruby-stack-02-lifecycle branch from 79c2bb6 to ce28f5b Compare August 12, 2026 10:07
@jackalcooper
jackalcooper force-pushed the agent/mruby-stack-02-lifecycle branch 2 times, most recently from 6aabc10 to b533d6e Compare August 12, 2026 10:24
@jackalcooper
jackalcooper force-pushed the agent/mruby-stack-02-lifecycle branch from b533d6e to c9b726b Compare August 12, 2026 10:28
@jackalcooper
jackalcooper force-pushed the agent/mruby-stack-02-lifecycle branch from c9b726b to 34b8547 Compare August 12, 2026 10:58
@jackalcooper
jackalcooper marked this pull request as ready for review August 12, 2026 11:23
@jackalcooper
jackalcooper merged commit 8dc987c into main Aug 12, 2026
15 checks passed
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