Commit ee2fb52
fix: prevent heap overflow in large monorepo scans
Add streaming-based filtering to globWithGitIgnore to prevent heap overflow
when scanning large monorepos with 100k+ files. Instead of accumulating all
file paths and filtering afterwards, files are now filtered during streaming
which dramatically reduces memory usage.
Changes:
- Add `filter` option to globWithGitIgnore for early filtering during streaming
- Add createSupportedFilesFilter helper to create filter from supported files
- Update getPackageFilesForScan to use streaming filter
Fixes SMO-522
Ported from v1.x commit 9bbb8e8 ([SMO-522] Fix heap overflow in large monorepo scans #1026)
Co-authored-by: Mikola Lysenko <mikolalysenko@gmail.com>1 parent c4b1339 commit ee2fb52
File tree
3 files changed
+48
-14
lines changed- packages/cli/src/utils/fs
3 files changed
+48
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
7 | 12 | | |
8 | 13 | | |
9 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
168 | 176 | | |
169 | 177 | | |
170 | 178 | | |
| |||
179 | 187 | | |
180 | 188 | | |
181 | 189 | | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
182 | 194 | | |
183 | 195 | | |
184 | 196 | | |
| |||
188 | 200 | | |
189 | 201 | | |
190 | 202 | | |
| 203 | + | |
191 | 204 | | |
192 | 205 | | |
193 | 206 | | |
| |||
244 | 257 | | |
245 | 258 | | |
246 | 259 | | |
247 | | - | |
| 260 | + | |
| 261 | + | |
248 | 262 | | |
249 | 263 | | |
250 | | - | |
251 | 264 | | |
252 | 265 | | |
253 | | - | |
254 | | - | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
255 | 270 | | |
256 | 271 | | |
257 | 272 | | |
258 | 273 | | |
259 | 274 | | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
265 | 289 | | |
| 290 | + | |
266 | 291 | | |
267 | | - | |
| 292 | + | |
268 | 293 | | |
269 | 294 | | |
270 | 295 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
130 | | - | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
131 | 136 | | |
132 | 137 | | |
133 | 138 | | |
| 139 | + | |
134 | 140 | | |
135 | 141 | | |
136 | 142 | | |
137 | | - | |
138 | | - | |
139 | 143 | | |
0 commit comments