Skip to content

Commit d5b5e37

Browse files
committed
fixup! perf_hooks: fix stack overflow error
1 parent cf7a75d commit d5b5e37

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/internal/per_context/primordials.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -725,17 +725,17 @@ primordials.SafeStringPrototypeSearch = (str, regexp) => {
725725
/**
726726
* Variadic functions with lots of arguments will cause stack overflow errors.
727727
* Use this function when `items` can be arbitrarily large, this function splits
728-
* it into chunks of size 4096 making stack overflow less likely.
728+
* it into chunks of size 2**16 making stack overflow less likely.
729729
* @param {Array<unknown>} arr
730730
* @param {Parameters<typeof Array.prototype.push>} items
731731
* @returns {ReturnType<typeof Array.prototype.push>}
732732
*/
733733
primordials.SafeArrayPrototypePushApply = (arr, items) => {
734734
let start = 0;
735-
let end = start + 0x1000;
735+
let end = 0x10000;
736736
while (end < items.length) {
737737
ArrayPrototypePushApply(arr, ArrayPrototypeSlice(items, start, start = end));
738-
end += 0x1000;
738+
end += 0x10000;
739739
}
740740
return ArrayPrototypePushApply(arr, ArrayPrototypeSlice(items, start));
741741
};

0 commit comments

Comments
 (0)