Commit 2014eba
committed
worker: use engine-provided deleter for
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>SharedArrayBuffers1 parent e14f864 commit 2014ebaCopy full SHA for 2014eba
File tree
Expand file treeCollapse file tree
5 files changed
+62
-9
lines changedOpen diff view settings
Filter options
- src
- test
- fixtures
- parallel
Expand file treeCollapse file tree
5 files changed
+62
-9
lines changedOpen diff view settings
Collapse file
src/sharedarraybuffer_metadata.cc
Copy file name to clipboardExpand all lines: src/sharedarraybuffer_metadata.cc+10-6Lines changed: 10 additions & 6 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
89 | 89 | |
90 | 90 | |
91 | 91 | |
92 | | - |
93 | | - |
| 92 | + |
94 | 93 | |
95 | 94 | |
96 | 95 | |
| ||
111 | 110 | |
112 | 111 | |
113 | 112 | |
114 | | - |
115 | | - |
| 113 | + |
| 114 | + |
| 115 | + |
116 | 116 | |
117 | 117 | |
118 | | - |
| 118 | + |
| 119 | + |
| 120 | + |
119 | 121 | |
120 | 122 | |
121 | 123 | |
122 | 124 | |
123 | 125 | |
124 | | - |
| 126 | + |
| 127 | + |
| 128 | + |
125 | 129 | |
126 | 130 | |
127 | 131 | |
|
Collapse file
src/sharedarraybuffer_metadata.h
Copy file name to clipboardExpand all lines: src/sharedarraybuffer_metadata.h+2-3Lines changed: 2 additions & 3 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
46 | 46 | |
47 | 47 | |
48 | 48 | |
49 | | - |
| 49 | + |
50 | 50 | |
51 | 51 | |
52 | 52 | |
53 | 53 | |
54 | 54 | |
55 | 55 | |
56 | 56 | |
57 | | - |
58 | | - |
| 57 | + |
59 | 58 | |
60 | 59 | |
61 | 60 | |
|
Binary file not shown.
Collapse file
test/fixtures/wasm-threads-shared-memory.wat
Copy file name to clipboard+4Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
Collapse file
test/parallel/test-worker-message-port-wasm-threads.js
Copy file name to clipboard+46Lines changed: 46 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | + |
0 commit comments