Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

When should DoAgentFinalization be called? #36

Closed
gsathya opened this issue Oct 25, 2018 · 3 comments
Closed

When should DoAgentFinalization be called? #36

gsathya opened this issue Oct 25, 2018 · 3 comments

Comments

@gsathya
Copy link
Member

gsathya commented Oct 25, 2018

Is this something that should be embedder defined?

cc @dtribble @erights @marjakh

@tschneidereit
Copy link
Member

The timing of DoAgentFinalization should probably be wholly implementation defined. In practice, I'd expect it to happen at the end of the sweep phase, but for engines with incremental or concurrent sweeping, there's no fundamental reason why it couldn't happen after each slice/in the process of the concurrent sweeping.

The results of this become visible through cleanupSome, which should probably always invoke the callback, and whose iterator should yield items as long as the queue isn't empty.

Another question is when this queue should be processed automatically, invoking the cleanup callback passed to the WeakFactory's constructor. On that, I think we should specify that it must not happen before the end of the current task, but that otherwise the timing is implementation defined, too.

@marjakh
Copy link
Contributor

marjakh commented Oct 31, 2018

DoAgentFinalization seems to assume to have a current Realm ("native context") though, and during GC there's none. See also #38 for a suggested fix.

@littledan
Copy link
Member

We ended up making this call embedder-defined. See #86 for details.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants