Commit 999bf22
repl: keep reference count for
When investigating a memory leak in one of our applications,
we discovered that this listener holds on to a `REPLServer`
instance and all heap objects transitively kept alive by it
by capturing as part of its closure.
It's cleaner to declare the listener outside of the `REPLServer`
class and to actually clean it up properly when it is no longer
required or meaningful, which is easily achieved through
keeping a reference count.
PR-URL: #61895
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>process.on('newListener')
1 parent f3d3968 commit 999bf22Copy full SHA for 999bf22
2 files changed
+49-19Lines changed: 49 additions & 19 deletions
File tree
Expand file treeCollapse file tree
Open diff view settings
Filter options
- lib
- test/parallel
Expand file treeCollapse file tree
Open diff view settings
Collapse file
+32-19Lines changed: 32 additions & 19 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
183 | 183 | |
184 | 184 | |
185 | 185 | |
186 | | - |
| 186 | + |
| 187 | + |
| 188 | + |
| 189 | + |
| 190 | + |
| 191 | + |
| 192 | + |
| 193 | + |
| 194 | + |
| 195 | + |
| 196 | + |
| 197 | + |
| 198 | + |
| 199 | + |
| 200 | + |
| 201 | + |
| 202 | + |
| 203 | + |
| 204 | + |
| 205 | + |
| 206 | + |
| 207 | + |
| 208 | + |
| 209 | + |
| 210 | + |
| 211 | + |
| 212 | + |
| 213 | + |
| 214 | + |
187 | 215 | |
188 | 216 | |
189 | 217 | |
| ||
337 | 365 | |
338 | 366 | |
339 | 367 | |
340 | | - |
341 | | - |
342 | | - |
343 | | - |
344 | | - |
345 | | - |
346 | | - |
347 | | - |
348 | | - |
349 | | - |
350 | | - |
351 | | - |
352 | | - |
353 | | - |
354 | | - |
355 | | - |
356 | | - |
357 | | - |
| 368 | + |
| 369 | + |
| 370 | + |
358 | 371 | |
359 | 372 | |
360 | 373 | |
|
Collapse file
test/parallel/test-repl-no-terminal-restore-process-listeners.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 | + |
0 commit comments