Skip to content

Conversation

@addaleax
Copy link
Member

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-botnodejs-github-bot added the c++ Issues and PRs that require attention from people who are familiar with C++. label Jan 1, 2019
@addaleaxaddaleax added the worker Issues and PRs related to Worker support. label Jan 1, 2019
@devsnekdevsnek added experimental Issues and PRs related to experimental features. wasm Issues and PRs related to WebAssembly. labels Jan 1, 2019
@addaleax
Copy link
MemberAuthor

@addaleax
Copy link
MemberAuthor

addaleax commented Jan 1, 2019

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

@addaleaxaddaleax 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
MemberAuthor

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
MemberAuthor

Fixed the extended test on Windows.

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

@addaleax
Copy link
MemberAuthor

Landed in 1f1a373

@addaleaxaddaleax closed this Jan 3, 2019
@addaleaxaddaleax 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 <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
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 <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
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 <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
@BridgeARBridgeAR 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 <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
@MylesBorinsMylesBorins mentioned this pull request Jan 24, 2019
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs 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++.experimentalIssues and PRs related to experimental features.wasmIssues and PRs related to WebAssembly.workerIssues and PRs related to Worker support.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@addaleax@nodejs-github-bot@jasnell@TimothyGu@devsnek