Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

FixJSClosure leak#240

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
kateinoigakukun merged 4 commits intomainfromkatei/fix-closure-leak
Apr 12, 2024
Merged

FixJSClosure leak#240

kateinoigakukun merged 4 commits intomainfromkatei/fix-closure-leak
Apr 12, 2024

Conversation

@kateinoigakukun
Copy link
Member

letc1=JSClosure{ _in.undefined}consume c1

did not release theJSClosure itself and it leaked the underlying
JavaScript closure too becauseJSClosure -> JS closure thunk ->
Closure registry entry ->JSClosure reference cycle was not broken
when using FinalizationRegistry. (Without FR, it was broken by manual
release call.)

Note that weakening the reference does not violates the contract that
function reference should be unique because holding a weak reference does
deinit but not deallocate the object, so ObjectIdentifier is not reused
until the weak reference in the registry is removed.

omochi and lin72h reacted with thumbs up emoji
```swiftlet c1 = JSClosure { _ in .undefined }consume c1```did not release the `JSClosure` itself and it leaked the underlyingJavaScript closure too because `JSClosure` -> JS closure thunk ->Closure registry entry -> `JSClosure` reference cycle was not brokenwhen using FinalizationRegistry. (Without FR, it was broken by manual`release` call.)Note that weakening the reference does not violates the contract thatfunction reference should be unique because holding a weak reference doesdeinit but not deallocate the object, so ObjectIdentifier is not reuseduntil the weak reference in the registry is removed.
The test suite was not properly releasing the closures but they have notbeen revealed as a problem because those closures were leakedconservatively.
…tractThis additional information will help developers to find the root cause
@github-actions
Copy link

github-actionsbot commentedApr 7, 2024
edited
Loading

Time Change: +325ms (3%)

Total Time: 9,697ms

Test nameDurationChange
Serialization/JavaScript function call through Wasm import23ms+2ms (6%)🔍
Serialization/JavaScript function call through Wasm import with int16ms+2ms (9%)🔍
Serialization/JavaScript function call from Swift103ms+7ms (7%)🔍
Serialization/JavaScript Number to Swift Int331ms+32ms (9%)🔍
View Unchanged
Test nameDurationChange
Serialization/Swift Int to JavaScript with assignment334ms+17ms (4%)
Serialization/Swift Int to JavaScript with call993ms+32ms (3%)
Serialization/Swift String to JavaScript with assignment391ms+8ms (2%)
Serialization/Swift String to JavaScript with call1,048ms+30ms (2%)
Serialization/JavaScript String to Swift String3,821ms+158ms (4%)
Object heap/Increment and decrement RC2,625ms+37ms (1%)
View Baselines
Test nameDuration
Serialization/Call JavaScript function directly3ms
Serialization/Assign JavaScript number directly3ms
Serialization/Call with JavaScript number directly3ms
Serialization/Write JavaScript string directly3ms
Serialization/Call with JavaScript string directly3ms

@kateinoigakukunkateinoigakukun requested a review froma teamApril 7, 2024 06:57
@kateinoigakukun
Copy link
MemberAuthor

Tested with a random large-scale application and no major regression found

@kateinoigakukunkateinoigakukun merged commitd9a4a9f intomainApr 12, 2024
@kateinoigakukunkateinoigakukun deleted the katei/fix-closure-leak branchApril 12, 2024 09:02
kateinoigakukun added a commit that referenced this pull requestApr 12, 2024
kateinoigakukun added a commit that referenced this pull requestApr 12, 2024
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@kateinoigakukun

[8]ページ先頭

©2009-2025 Movatter.jp