Search code examples
node.jsv8

V8/Node.js increase max allowed String length


AFAIK V8 has a known hard limit on the length of allowed Strings. Trying to parse >500MB Strings will pop the error:

Invalid String Length

Using V8 flags to increase the heap size doesn't make any difference

$ node --max_old_space_size=5000 process-large-string.js

I know that I should be using Streams instead. However is there any way to increase the maximum allowed String length anyway?


Update: Answer from @PaulIrish below indicates they upped it to 1GB - but it's still not user-configurable


Solution

  • Sorry, no, there is no way to increase the maximum allowed String length.

    It is hard-coded in the source, and a lot of code implicitly relies on it, so while allowing larger strings is known to be on people's wishlist, it is going to be a lot of work and won't happen in the near future.