Skip to content

fix(ts): don't retain the last Driver in observerEntries - #197

Closed
kommander wants to merge 1 commit into
devfrom
fix/driver-observer-entries-leak
Closed

kommander wants to merge 1 commit into
devfrom
fix/driver-observer-entries-leak

Conversation

@kommander

Copy link
Copy Markdown
Contributor

Driver's constructor assigned observerEntries.last = () => this.reported.size + this.observed.size unconditionally, retaining the finished Driver, Vm, and host context until another Driver was created (from #192). Switched observerEntries to an opt-in onDriver hook, matching parking.onPark above it, with a GC regression test.

@jlongster

Copy link
Copy Markdown
Collaborator

@kommander thanks for catching this! observerEntries was only ever a test hook, so rather than making it opt-in we can drop it entirely and test the pruning through behaviour (WeakRef + GC on the observed calls while the run is still going). That's in #199, which keeps your "finished run is not retained" regression test, credited to you. Mind if we close this one in favour of it?

@kommander

Copy link
Copy Markdown
Contributor Author

Sounds great, closing in favor of #199!

@kommander kommander closed this Dec 3, 2026
@kommander
kommander deleted the fix/driver-observer-entries-leak branch December 3, 2026 00:38
jlongster added a commit that referenced this pull request Dec 3, 2026
…hrough behaviour (#199)

observerEntries was a module global the Driver constructor overwrote with a
closure over itself, so the last driver (its VM, globals and host context)
stayed reachable after its run ended. It existed only for tests, so it is
removed rather than made opt-in.

The per-call pruning tests now check behaviour: WeakRefs to the ObservedCall
each finished durable call's before hook saw are collected while the run is
still alive, and a finished run is not retained after execute returns.

Thanks to #197 / @kommander for finding the retention and for the regression
test this adapts.
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.

2 participants