V8/Node.js increase max allowed String length


AFAIK V8 has a known <a href="https://github.com/nodejs/node-v0.x-archive/issues/14170" rel="nofollow">hard limit on the length of allowed Strings</a>. 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?

<hr />

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


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.


In summer 2017, V8 increased the maximum size of strings <strong>from ~256MB to ~1GB</strong>. Specifically, from 2^28 - 16 to 2^30 - 25 on 64-bit platforms. <a href="https://bugs.chromium.org/p/v8/issues/detail?id=6148#c10" rel="nofollow">V8 ticket.</a>

This change landed in:

<ul><li>V8: 6.2.100</li> <li>Chromium: 62.0.3167.0</li> <li>Node.js: 9.0.0</li> </ul>


  • Regex to fetch only Key Value pairs and omit some charaters
  • Measure heap used by each object in Java [closed]
  • Binary Tree Traversal Sum Of Each Depth
  • Small video playback
  • Counting Treaps
  • Selecting a subset of data in ServiceStack.OrmLite
  • F#: In which memory area is the continuation stored: stack or heap?
  • Connecting bluetooth device to windows phone 8 application
  • Compress a file with GZipStream while maintaining its meta-data
  • Is there a way to dynamically embed PDF Files in a JSP pulled from the file system?
  • Write output of for loop to multiple files
  • Plotting densities in R
  • Consuming a WCF service in a Java Client using wsHttpBinding
  • Getting NullPointer exception with File.listfiles()
  • Android device acting as an accessory
  • Simple linked list-C
  • Implicit joins and Where in Doctrine - how?
  • Java color detection
  • I18n locale disregarding fallbacks
  • converting text file into xml using php?
  • CakePHP ACL tutorial initDB function warnings
  • zope_i18n_compile_mo_files doesn't work on a Zeo configuration
  • OOP Javascript - Is “get property” method necessary?
  • How can I sort a a table with VBA with given text condition?
  • Magento Fatal error: Maximum execution error solution, on WAMP
  • Change multiple background-images with jQuery
  • Scrapy recursive link crawler
  • Android screen density dpi vs ppi
  • What is Eclipse's Declaration View used for?
  • How to make a tree having multiple type of nodes and each node can have multiple child nodes in java
  • DirectX11 ClearRenderTargetViewback with transparent buffer?
  • Change an a tag attribute in JavaScript based on screen width
  • Jquery - Jquery Wysiwyg return html as a string
  • Arrays break string types in Julia
  • WPF Applying a trigger on binding failure
  • Understanding cpu registers
  • How do I configure my settings file to work with unit tests?
  • Java static initializers and reflection
  • How can i traverse a binary tree from right to left in java?
  • How do I use LINQ to get all the Items that have a particular SubItem?