Skip to content

Commit ca16edd

Browse files
committed
docs(runtime): explain wrapper lifetime scope and what resurrections counts
scope was documented as a key with no word on what it selects. And resurrections counts every finalizer pass, at least two per wrapper JS dropped and one per major GC for a wrapper whose object Java holds, which is not what iOS's counter of the same name means.
1 parent d19acd7 commit ca16edd

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎docs/ns-builtin-modules.md‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,10 @@ iOS reads:
165165

166166
A value that is not an object, or an unknown `mode` or `scope`, logs a warning
167167
and keeps the default. `"rooted"` is iOS-only: it reads native retain counts,
168-
which Java does not have.
168+
which Java does not have. `scope` chooses whose JS properties a mode other
169+
than `"resurrecting"` keeps while Java holds the object: `"extended"` those of
170+
instances of JS-extended classes, `"all"` those of every wrapper.
171+
`"resurrecting"` treats every wrapper alike whatever the scope.
169172

170173
`"resurrecting"` (the default) keeps a collected wrapper while Java may still
171174
hold its object. The first collection resurrects it and makes the Java side
@@ -180,7 +183,7 @@ every build on cold paths only:
180183

181184
| counter | counts |
182185
|---|---|
183-
| `resurrections` | finalizer callbacks that kept a collected wrapper until the Java side says whether its object is still alive |
186+
| `resurrections` | finalizer passes that kept a collected wrapper until the Java side says whether its object is still alive. Every pass counts, so a wrapper JS dropped counts at least twice (once to weaken the Java side, once more to check whether Java collected the object) and one whose object Java holds counts again on every major GC. Unlike iOS's counter of the same name, it is not a number of wrappers native code kept alive |
184187
| `weakened` | Java objects held weakly because their wrapper was collected |
185188
| `collected` | wrappers released because Java had collected their object |
186189
| `releasedExplicitly` | links released through `__releaseNativeCounterpart` |

0 commit comments

Comments
 (0)