Commit 04df7db
worker: keep allocators for transferred SAB instances alive longer
Keep the `ArrayBuffer::Allocator` behind a `SharedArrayBuffer` instance
alive for at least as long as the receiving Isolate lives, if the
`SharedArrayBuffer` instance isn’t already destroyed through GC.
This is to work around the fact that V8 7.9 started refactoring
how backing stores for `SharedArrayBuffer` instances work, changing
the timing of the call that releases the backing store to be
during Isolate disposal.
The flag added to the test is optional but helps verify that the
backing store is actually free’d at the end of the test and does not
leak memory.
Fixes: nodejs/node-v8#115
PR-URL: #29637
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>1 parent 91e4cc7 commit 04df7dbCopy full SHA for 04df7db
Expand file treeCollapse file tree
5 files changed
+51
-0
lines changedOpen diff view settings
Collapse file
+15Lines changed: 15 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
1036 | 1036 | |
1037 | 1037 | |
1038 | 1038 | |
| 1039 | + |
| 1040 | + |
| 1041 | + |
| 1042 | + |
| 1043 | + |
| 1044 | + |
| 1045 | + |
| 1046 | + |
| 1047 | + |
| 1048 | + |
| 1049 | + |
| 1050 | + |
| 1051 | + |
| 1052 | + |
| 1053 | + |
1039 | 1054 | |
1040 | 1055 | |
1041 | 1056 | |
|
Collapse file
+8Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
1252 | 1252 | |
1253 | 1253 | |
1254 | 1254 | |
| 1255 | + |
| 1256 | + |
| 1257 | + |
| 1258 | + |
1255 | 1259 | |
1256 | 1260 | |
1257 | 1261 | |
| ||
1426 | 1430 | |
1427 | 1431 | |
1428 | 1432 | |
| 1433 | + |
| 1434 | + |
| 1435 | + |
| 1436 | + |
1429 | 1437 | |
1430 | 1438 | |
1431 | 1439 | |
|
Collapse file
src/sharedarraybuffer_metadata.cc
Copy file name to clipboardExpand all lines: src/sharedarraybuffer_metadata.cc+24Lines changed: 24 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
50 | 50 | |
51 | 51 | |
52 | 52 | |
| 53 | + |
| 54 | + |
| 55 | + |
| 56 | + |
| 57 | + |
| 58 | + |
| 59 | + |
| 60 | + |
| 61 | + |
| 62 | + |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | + |
| 67 | + |
| 68 | + |
| 69 | + |
| 70 | + |
| 71 | + |
| 72 | + |
| 73 | + |
| 74 | + |
| 75 | + |
| 76 | + |
53 | 77 | |
54 | 78 | |
55 | 79 | |
|
Collapse file
src/sharedarraybuffer_metadata.h
Copy file name to clipboardExpand all lines: src/sharedarraybuffer_metadata.h+3Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
37 | 37 | |
38 | 38 | |
39 | 39 | |
| 40 | + |
| 41 | + |
| 42 | + |
40 | 43 | |
41 | 44 | |
42 | 45 | |
|
Collapse file
test/parallel/test-worker-sharedarraybuffer-from-worker-thread.js
Copy file name to clipboardExpand all lines: test/parallel/test-worker-sharedarraybuffer-from-worker-thread.js+1Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
1 | 2 | |
2 | 3 | |
3 | 4 | |
|
0 commit comments