Skip to content

fix(napi): memory leak in PromiseRaw callbacks#2348

Merged
Brooooooklyn merged 1 commit intomainfrom
11-07-fix_napi_memory_leak_in_promiseraw_callbacks
Nov 7, 2024
Merged

fix(napi): memory leak in PromiseRaw callbacks#2348
Brooooooklyn merged 1 commit intomainfrom
11-07-fix_napi_memory_leak_in_promiseraw_callbacks

Conversation

@Brooooooklyn
Copy link
Copy Markdown
Member

No description provided.

Copy link
Copy Markdown
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @Brooooooklyn and the rest of your teammates on Graphite Graphite

Copy link
Copy Markdown
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Details
Benchmark suite Current: 595b5e1 Previous: cf23055 Ratio
noop#napi-rs 78324411 ops/sec (±0.49%) 86709024 ops/sec (±0.3%) 1.11
noop#JavaScript 821883899 ops/sec (±0.28%) 821155810 ops/sec (±0.18%) 1.00
Plus number#napi-rs 22537174 ops/sec (±0.2%) 23526928 ops/sec (±0.16%) 1.04
Plus number#JavaScript 821971236 ops/sec (±0.1%) 821711105 ops/sec (±0.1%) 1.00
Create buffer#napi-rs 663742 ops/sec (±12.95%) 662733 ops/sec (±12.28%) 1.00
Create buffer#JavaScript 3084511 ops/sec (±6.4%) 4100841 ops/sec (±3.02%) 1.33
createArray#createArrayJson 54781 ops/sec (±0.6%) 54379 ops/sec (±0.17%) 0.99
createArray#create array for loop 9861 ops/sec (±0.45%) 9784 ops/sec (±1.37%) 0.99
createArray#create array with serde trait 10015 ops/sec (±0.16%) 9983 ops/sec (±0.55%) 1.00
getArrayFromJs#get array from json string 23838 ops/sec (±0.43%) 23636 ops/sec (±0.42%) 0.99
getArrayFromJs#get array from serde 13607 ops/sec (±0.6%) 13655 ops/sec (±0.18%) 1.00
getArrayFromJs#get array with for loop 16199 ops/sec (±0.07%) 16202 ops/sec (±0.04%) 1.00
Get Set property#Get Set from native#u32 574823 ops/sec (±12.3%) 572162 ops/sec (±13.06%) 1.00
Get Set property#Get Set from JavaScript#u32 549935 ops/sec (±2.24%) 555672 ops/sec (±2.5%) 1.01
Get Set property#Get Set from native#string 567962 ops/sec (±11.27%) 570461 ops/sec (±12.07%) 1.00
Get Set property#Get Set from JavaScript#string 522233 ops/sec (±1.96%) 523291 ops/sec (±2%) 1.00
Async task#spawn task 27122 ops/sec (±0.27%) 26756 ops/sec (±0.73%) 0.99
Async task#ThreadSafeFunction 9489 ops/sec (±1.07%) 9577 ops/sec (±0.8%) 1.01
Async task#Tokio future to Promise 31578 ops/sec (±0.86%) 32556 ops/sec (±0.9%) 1.03
Query#query * 100 3579 ops/sec (±0.52%) 3568 ops/sec (±0.72%) 1.00
Query#query * 1 26209 ops/sec (±1.11%) 26816 ops/sec (±0.59%) 1.02

This comment was automatically generated by workflow using github-action-benchmark.

@Brooooooklyn Brooooooklyn merged commit 726f888 into main Nov 7, 2024
Copy link
Copy Markdown
Member Author

Merge activity

  • Nov 7, 12:19 AM EST: A user merged this pull request with Graphite.

@Brooooooklyn Brooooooklyn deleted the 11-07-fix_napi_memory_leak_in_promiseraw_callbacks branch November 7, 2024 05:19
Brooooooklyn added a commit to Brooooooklyn/canvas that referenced this pull request Nov 7, 2024
There 2 leak points in the `Image` class.

1. The `Env::create_reference` was wrong in NAPI-RS, related pr: napi-rs/napi-rs#2347, change to the `Ref::new` can resolve it.
2. The `PromiseRaw::catch` callback was leaked, it cause the whole `Image` objects not be GCed, it was fixed in napi-rs/napi-rs#2348
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