Skip to content

Fix stack overflow#53

Open
chrismwendt wants to merge 1 commit into
seald:masterfrom
chrismwendt:fix-stack-overflow
Open

Fix stack overflow#53
chrismwendt wants to merge 1 commit into
seald:masterfrom
chrismwendt:fix-stack-overflow

Conversation

@chrismwendt

Copy link
Copy Markdown

This replaces a spread call validDocs.push(...docs) where validDocs was empty with simple assignment validDocs = docs to avoid a stack overflow with a big docs array.

RangeError: Maximum call stack size exceeded

Spread calls use stack space, so foo.push(...REALLY_BIG_ARRAY) uses LOTS of stack space and it can easily cause a stack overflow.

@Llorx

Llorx commented Aug 8, 2024

Copy link
Copy Markdown

This fix makes a lot of sense as there's no need to push to an empty array when you can just reassign it. Just thinking on optimizations it makes a lot of sense. How is it going @tex0l @arantes555

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants