Commit e8af569
committed
buffer: release buffers with free callbacks on env exit
Invoke the free callback for a given `Buffer` if it was created
with one, and mark the underlying `ArrayBuffer` as detached.
This makes sure that the memory is released e.g. when addons inside
Workers create such `Buffer`s.
PR-URL: #30551
Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>1 parent 40b7621 commit e8af569Copy full SHA for e8af569
File tree
Expand file treeCollapse file tree
4 files changed
+95
-10
lines changedOpen diff view settings
Filter options
- src
- test
- addons/worker-buffer-callback
- cctest
Expand file treeCollapse file tree
4 files changed
+95
-10
lines changedOpen diff view settings
Collapse file
+36-9Lines changed: 36 additions & 9 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
53 | 53 | |
54 | 54 | |
55 | 55 | |
| 56 | + |
56 | 57 | |
57 | 58 | |
58 | 59 | |
| ||
73 | 74 | |
74 | 75 | |
75 | 76 | |
| 77 | + |
| 78 | + |
76 | 79 | |
77 | | - |
| 80 | + |
78 | 81 | |
79 | 82 | |
80 | 83 | |
| ||
84 | 87 | |
85 | 88 | |
86 | 89 | |
| 90 | + |
87 | 91 | |
88 | 92 | |
89 | | - |
| 93 | + |
90 | 94 | |
91 | 95 | |
92 | 96 | |
| ||
95 | 99 | |
96 | 100 | |
97 | 101 | |
| 102 | + |
98 | 103 | |
99 | 104 | |
100 | 105 | |
| ||
103 | 108 | |
104 | 109 | |
105 | 110 | |
106 | | - |
| 111 | + |
107 | 112 | |
108 | 113 | |
109 | 114 | |
110 | 115 | |
111 | | - |
| 116 | + |
112 | 117 | |
113 | 118 | |
114 | 119 | |
115 | | - |
| 120 | + |
116 | 121 | |
117 | 122 | |
118 | 123 | |
119 | 124 | |
120 | | - |
| 125 | + |
121 | 126 | |
122 | 127 | |
123 | | - |
| 128 | + |
| 129 | + |
124 | 130 | |
125 | 131 | |
126 | 132 | |
127 | 133 | |
128 | 134 | |
129 | 135 | |
130 | | - |
| 136 | + |
| 137 | + |
| 138 | + |
| 139 | + |
| 140 | + |
| 141 | + |
| 142 | + |
| 143 | + |
| 144 | + |
| 145 | + |
| 146 | + |
| 147 | + |
| 148 | + |
| 149 | + |
| 150 | + |
| 151 | + |
| 152 | + |
| 153 | + |
| 154 | + |
| 155 | + |
| 156 | + |
| 157 | + |
131 | 158 | |
132 | 159 | |
133 | 160 | |
| ||
388 | 415 | |
389 | 416 | |
390 | 417 | |
391 | | - |
| 418 | + |
392 | 419 | |
393 | 420 | |
394 | 421 | |
|
Collapse file
test/addons/worker-buffer-callback/binding.cc
Copy file name to clipboardExpand all lines: test/addons/worker-buffer-callback/binding.cc+10-1Lines changed: 10 additions & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
3 | 3 | |
4 | 4 | |
5 | 5 | |
| 6 | + |
6 | 7 | |
7 | 8 | |
8 | 9 | |
9 | 10 | |
10 | 11 | |
| 12 | + |
11 | 13 | |
12 | 14 | |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + |
13 | 19 | |
14 | 20 | |
15 | 21 | |
16 | 22 | |
| 23 | + |
17 | 24 | |
18 | 25 | |
19 | 26 | |
| ||
22 | 29 | |
23 | 30 | |
24 | 31 | |
25 | | - |
| 32 | + |
| 33 | + |
| 34 | + |
26 | 35 | |
27 | 36 | |
28 | 37 | |
|
Collapse file
test/addons/worker-buffer-callback/test-free-called.js
Copy file name to clipboard+17Lines changed: 17 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 | + |
Collapse file
test/cctest/test_environment.cc
Copy file name to clipboardExpand all lines: test/cctest/test_environment.cc+32Lines changed: 32 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
1 | 2 | |
2 | 3 | |
3 | 4 | |
| ||
208 | 209 | |
209 | 210 | |
210 | 211 | |
| 212 | + |
| 213 | + |
| 214 | + |
| 215 | + |
| 216 | + |
| 217 | + |
| 218 | + |
| 219 | + |
| 220 | + |
| 221 | + |
| 222 | + |
| 223 | + |
| 224 | + |
| 225 | + |
| 226 | + |
| 227 | + |
| 228 | + |
| 229 | + |
| 230 | + |
| 231 | + |
| 232 | + |
| 233 | + |
| 234 | + |
| 235 | + |
| 236 | + |
| 237 | + |
| 238 | + |
| 239 | + |
| 240 | + |
| 241 | + |
| 242 | + |
0 commit comments