Skip to content

Temporal.Now: @owned (rc leaked every call through a function value) - #122

Merged
ASDAlexander77 merged 1 commit into
mainfrom
temporal-now-owned
Nov 27, 2026
Merged

ASDAlexander77 merged 1 commit into
mainfrom
temporal-now-owned

Conversation

@ASDAlexander77

@ASDAlexander77 ASDAlexander77 commented Nov 27, 2026 •

Copy link
Copy Markdown
Owner

declare namespace Now inside Temporal (added in #108) had no @owned, unlike every other declaration in lib.d.ts. Its four functions were then the library's only heap results the compiler could not classify.

Under -mm=rc, one such declaration turns off, for the whole module, the rule that a call through a function value returns its result owned. Since #108, every program linking the library leaked the result of every call through a function value:

  • callbacks passed in as parameters
  • an object literal's arrow methods (o.make(i))
  • interface methods backed by such fields

For example, 2M calls of o.make(i) peaked at 129 MB instead of 33 MB.

With the marker, nothing in the library is unclassified again, and those probes stay flat at about 33 MB.

A related compiler change, which classifies a call to a function read out of a constant object literal by name, follows in a TypeScriptCompiler PR.

🤖 Generated with Claude Code

Its four functions were the library's only heap results the compiler could not
classify. One such declaration is enough to turn off, for the whole module,
the rule that a call through a function value hands its result over owned, so
under -mm=rc no program linking the library gave back the result of a callback
or of an object literal's method (a leak per call) since #108 added Temporal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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