Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

worker: use engine-provided deleter for SharedArrayBuffers #25307

Closed
wants to merge 3 commits into from

Conversation

addaleax
Copy link
Member

@addaleax addaleax commented Jan 1, 2019

Thanks to @devsnek for reporting this and coming up with a test case!


Store the full information we have on a given SharedArrayBuffer,
and use the deleter provided by the JS engine to free the memory
when that is needed.

This fixes memory lifetime management for WASM buffers that are
passed through a MessageChannel (e.g. between threads).

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

Store the full information we have on a given `SharedArrayBuffer`,
and use the deleter provided by the JS engine to free the memory
when that is needed.

This fixes memory lifetime management for WASM buffers that are
passed through a `MessageChannel` (e.g. between threads).
@nodejs-github-bot nodejs-github-bot added the c++ Issues and PRs that require attention from people who are familiar with C++. label Jan 1, 2019
@addaleax addaleax added the worker Issues and PRs related to Worker support. label Jan 1, 2019
@devsnek devsnek added experimental Issues and PRs related to experimental features. wasm Issues and PRs related to WebAssembly. labels Jan 1, 2019
@addaleax
Copy link
Member Author

addaleax commented Jan 1, 2019

@addaleax
Copy link
Member Author

addaleax commented Jan 1, 2019

Resume CI: https://ci.nodejs.org/job/node-test-pull-request/19907/ (:heavy_check_mark:)

@addaleax addaleax added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jan 1, 2019
@addaleax
Copy link
Member Author

addaleax commented Jan 2, 2019

Fwiw, I’ve extended the test a bit. (@devsnek I’ve also figured out that we can’t transfer WebAssembly.Modules yet the way we should – also working on that.)

New CI: https://ci.nodejs.org/job/node-test-pull-request/19915/

@addaleax
Copy link
Member Author

addaleax commented Jan 3, 2019

Fixed the extended test on Windows.

New CI: https://ci.nodejs.org/job/node-test-pull-request/19918/

@addaleax
Copy link
Member Author

addaleax commented Jan 3, 2019

Landed in 1f1a373

@addaleax addaleax closed this Jan 3, 2019
@addaleax addaleax deleted the sab-deleter branch January 3, 2019 22:55
addaleax added a commit that referenced this pull request Jan 3, 2019
Store the full information we have on a given `SharedArrayBuffer`,
and use the deleter provided by the JS engine to free the memory
when that is needed.

This fixes memory lifetime management for WASM buffers that are
passed through a `MessageChannel` (e.g. between threads).

PR-URL: #25307
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
addaleax added a commit that referenced this pull request Jan 5, 2019
Store the full information we have on a given `SharedArrayBuffer`,
and use the deleter provided by the JS engine to free the memory
when that is needed.

This fixes memory lifetime management for WASM buffers that are
passed through a `MessageChannel` (e.g. between threads).

PR-URL: #25307
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
refack pushed a commit to refack/node that referenced this pull request Jan 14, 2019
Store the full information we have on a given `SharedArrayBuffer`,
and use the deleter provided by the JS engine to free the memory
when that is needed.

This fixes memory lifetime management for WASM buffers that are
passed through a `MessageChannel` (e.g. between threads).

PR-URL: nodejs#25307
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
@BridgeAR BridgeAR mentioned this pull request Jan 16, 2019
BridgeAR pushed a commit to BridgeAR/node that referenced this pull request Jan 16, 2019
Store the full information we have on a given `SharedArrayBuffer`,
and use the deleter provided by the JS engine to free the memory
when that is needed.

This fixes memory lifetime management for WASM buffers that are
passed through a `MessageChannel` (e.g. between threads).

PR-URL: nodejs#25307
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
@MylesBorins MylesBorins mentioned this pull request Jan 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. c++ Issues and PRs that require attention from people who are familiar with C++. experimental Issues and PRs related to experimental features. wasm Issues and PRs related to WebAssembly. worker Issues and PRs related to Worker support.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants