Commit 686ac49
src: add percentage support to --max-old-space-size
This commit adds support for specifying --max-old-space-size as a
percentage of system memory, in addition to the existing MB format.
A new HandleMaxOldSpaceSizePercentage method parses percentage values,
validates that they are within the 0-100% range, and provides clear
error messages for invalid input. The heap size is now calculated
based on available system memory when a percentage is used.
Test coverage has been added for both valid and invalid cases.
Documentation and the JSON schema for CLI options have been updated
with examples for both formats.
Refs: #57447
PR-URL: #59082
Backport-PR-URL: #59631
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: theanarkh <theratliter@gmail.com>
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>1 parent 7067d79 commit 686ac49Copy full SHA for 686ac49
File tree
Expand file treeCollapse file tree
7 files changed
+223
-0
lines changedOpen diff view settings
Filter options
- doc
- api
- src
- test/parallel
Expand file treeCollapse file tree
7 files changed
+223
-0
lines changedOpen diff view settings
Collapse file
+17Lines changed: 17 additions & 0 deletions
- Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
1702 | 1702 | |
1703 | 1703 | |
1704 | 1704 | |
| 1705 | + |
| 1706 | + |
| 1707 | + |
| 1708 | + |
| 1709 | + |
| 1710 | + |
| 1711 | + |
| 1712 | + |
| 1713 | + |
| 1714 | + |
| 1715 | + |
| 1716 | + |
| 1717 | + |
| 1718 | + |
| 1719 | + |
| 1720 | + |
1705 | 1721 | |
1706 | 1722 | |
1707 | 1723 | |
| ||
3387 | 3403 | |
3388 | 3404 | |
3389 | 3405 | |
| 3406 | + |
3390 | 3407 | |
3391 | 3408 | |
3392 | 3409 | |
|
Collapse file
doc/node-config-schema.json
Copy file name to clipboardExpand all lines: doc/node-config-schema.json+3Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
278 | 278 | |
279 | 279 | |
280 | 280 | |
| 281 | + |
| 282 | + |
| 283 | + |
281 | 284 | |
282 | 285 | |
283 | 286 | |
|
Collapse file
+10Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
346 | 346 | |
347 | 347 | |
348 | 348 | |
| 349 | + |
| 350 | + |
| 351 | + |
| 352 | + |
| 353 | + |
| 354 | + |
| 355 | + |
| 356 | + |
| 357 | + |
| 358 | + |
349 | 359 | |
350 | 360 | |
351 | 361 | |
|
Collapse file
+7Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
818 | 818 | |
819 | 819 | |
820 | 820 | |
| 821 | + |
| 822 | + |
| 823 | + |
| 824 | + |
| 825 | + |
| 826 | + |
| 827 | + |
821 | 828 | |
822 | 829 | |
823 | 830 | |
|
Collapse file
+48Lines changed: 48 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
7 | 7 | |
8 | 8 | |
9 | 9 | |
| 10 | + |
10 | 11 | |
11 | 12 | |
12 | 13 | |
13 | 14 | |
14 | 15 | |
15 | 16 | |
16 | 17 | |
| 18 | + |
17 | 19 | |
18 | 20 | |
19 | 21 | |
| ||
103 | 105 | |
104 | 106 | |
105 | 107 | |
| 108 | + |
| 109 | + |
| 110 | + |
| 111 | + |
| 112 | + |
| 113 | + |
| 114 | + |
| 115 | + |
| 116 | + |
| 117 | + |
| 118 | + |
| 119 | + |
| 120 | + |
| 121 | + |
| 122 | + |
| 123 | + |
| 124 | + |
| 125 | + |
| 126 | + |
| 127 | + |
| 128 | + |
| 129 | + |
| 130 | + |
| 131 | + |
| 132 | + |
| 133 | + |
| 134 | + |
| 135 | + |
| 136 | + |
| 137 | + |
| 138 | + |
| 139 | + |
| 140 | + |
| 141 | + |
| 142 | + |
| 143 | + |
| 144 | + |
106 | 145 | |
107 | 146 | |
| 147 | + |
| 148 | + |
| 149 | + |
| 150 | + |
108 | 151 | |
109 | 152 | |
110 | 153 | |
| ||
987 | 1030 | |
988 | 1031 | |
989 | 1032 | |
| 1033 | + |
| 1034 | + |
| 1035 | + |
| 1036 | + |
| 1037 | + |
990 | 1038 | |
991 | 1039 | |
992 | 1040 | |
|
Collapse file
+4Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
283 | 283 | |
284 | 284 | |
285 | 285 | |
| 286 | + |
| 287 | + |
286 | 288 | |
287 | 289 | |
288 | 290 | |
289 | 291 | |
290 | 292 | |
291 | 293 | |
292 | 294 | |
| 295 | + |
| 296 | + |
293 | 297 | |
294 | 298 | |
295 | 299 | |
|
Collapse file
test/parallel/test-max-old-space-size-percentage.js
Copy file name to clipboard+134Lines changed: 134 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 | + |
| 47 | + |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | + |
| 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 | + |
| 77 | + |
| 78 | + |
| 79 | + |
| 80 | + |
| 81 | + |
| 82 | + |
| 83 | + |
| 84 | + |
| 85 | + |
| 86 | + |
| 87 | + |
| 88 | + |
| 89 | + |
| 90 | + |
| 91 | + |
| 92 | + |
| 93 | + |
| 94 | + |
| 95 | + |
| 96 | + |
| 97 | + |
| 98 | + |
| 99 | + |
| 100 | + |
| 101 | + |
| 102 | + |
| 103 | + |
| 104 | + |
| 105 | + |
| 106 | + |
| 107 | + |
| 108 | + |
| 109 | + |
| 110 | + |
| 111 | + |
| 112 | + |
| 113 | + |
| 114 | + |
| 115 | + |
| 116 | + |
| 117 | + |
| 118 | + |
| 119 | + |
| 120 | + |
| 121 | + |
| 122 | + |
| 123 | + |
| 124 | + |
| 125 | + |
| 126 | + |
| 127 | + |
| 128 | + |
| 129 | + |
| 130 | + |
| 131 | + |
| 132 | + |
| 133 | + |
| 134 | + |
0 commit comments