JavaScript heap out of memory
See original GitHub issueImporting the common and en language packages using webpack (under CRA4) causes the dev server memory usage to skyrocket upon start, resulting in an immediate V8 out-of-memory crash.
Usage:
import zxcvbnCommonPackage from '@zxcvbn-ts/language-common/'
import zxcvbnEnPackage from '@zxcvbn-ts/language-en/dist/'
const password = 'somePassword'
const options = {
translations: zxcvbnEnPackage.translations,
graphs: zxcvbnCommonPackage.adjacencyGraphs,
dictionary: {
...zxcvbnCommonPackage.dictionary,
...zxcvbnEnPackage.dictionary,
},
}
ZxcvbnOptions.setOptions(options)
zxcvbn(password)
Stack trace:
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 00007FF60F0C412F napi_wrap+133311
2: 00007FF60F05DD06 SSL_get_quiet_shutdown+63062
3: 00007FF60F05EB9D node::OnFatalError+301
4: 00007FF60F9419CE v8::Isolate::ReportExternalAllocationLimitReached+94
5: 00007FF60F9267BD v8::SharedArrayBuffer::Externalize+781
6: 00007FF60F7CFFCC v8::internal::Heap::EphemeronKeyWriteBarrierFromCode+1516
7: 00007FF60F7DB3EA v8::internal::Heap::ProtectUnprotectedMemoryChunks+1258
8: 00007FF60F7D8529 v8::internal::Heap::PageFlagsAreConsistent+2457
9: 00007FF60F7CD0C1 v8::internal::Heap::CollectGarbage+2049
10: 00007FF60F7CB2C5 v8::internal::Heap::AllocateExternalBackingStore+1349
11: 00007FF60F7EB73B v8::internal::Factory::NewFillerObject+203
12: 00007FF60F519E0F v8::internal::interpreter::JumpTableTargetOffsets::iterator::operator=+1039
13: 00007FF60F9CCDFD v8::internal::SetupIsolateDelegate::SetupHeap+474253
14: 0000011BD541E117
npm ERR! code ELIFECYCLE
npm ERR! errno 134
npm ERR! my-app@0.1.0 start: `react-scripts start`
npm ERR! Exit status 134
npm ERR!
npm ERR! Failed at the my-app@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.```
Issue Analytics
- State:
- Created 2 years ago
- Comments:8
Top Results From Across the Web
How to Fix JavaScript Heap Out of Memory Error - MakeUseOf
A common problem while working on a JavaScript Node.js project is the “JavaScript heap out of memory” error. This error usually occurs when ......
Read more >Node.js heap out of memory - javascript - Stack Overflow
I have a 64-bit CPU and I've installed x86 node version, which caused the CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory ......
Read more >JavaScript heap out of memory - Snyk Support
This generally occurs on larger projects where the default amount of memory allocated by Node (1.5gb) is insufficient to complete the command successfully....
Read more >How to solve JavaScript heap out of memory error
To fix JavaScript heap out of memory error, you need to add the --max-old-space-size option when running your npm command. ... Alternatively, you ......
Read more >JavaScript Heap Out Of Memory Error - OpenReplay Blog
A quick solution that you can use to fix "Heap Out Of Memory Error" in JavaScript. We lay out the causes and how...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I just release version 1.0.0 with this issue included. In my starter setup for CRA4 it worked now. Can you try it out for youself?
I don’t think it is a direct issue with zxcvbn-ts because it will already crash if you only import the password.js file into a fresh repo. The content of this file is only one variable with a big array.
But it seems like the approach from the original repo is more fit for big data like that. In the original repo those dictionaries are not an array but a string that is splitted on runtime. I thought it would be a good idea to directly use an array to increase runtime performance but it seems like this comes with a downside for some dev servers 🤔
I will adjust the dictionaries so that they match the original initalization with the split function. Thanks for the finding 👍