-
Notifications
You must be signed in to change notification settings - Fork 12k
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory #22020
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi Alan, Thx for pointing me to #20801. I've spent the last week studying that and was unable to figure out how to get a heap snapshot when triggering a build (serve) from VS Code. However, I have come up with a workaround/hack(?) that seems to solve my problem. If I issue the following in a newly opened PowerShell console in VS Code I am able to avoid the heap OOM on my rebuilds (re-serves): It looks like VS Code ignores a globally set environment variable so I have to set it in the same process where the build occurs. That' interesting because "dir env:" shows that all of the other global environment variables have been inherited - just not NODE_OPTIONS. I have no idea if I just needed some additional memory or if there is still a bug but I just haven't done enough rebuilds(re-serves) to trigger it again. Any ideas/comments? Thx, |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
🐞 Bug report
Is this a regression?
No - this just started happening without any (immediately prior) updates/upgrades
Description
I am using VS Code (with the Nrwl nx extension) to build the Angular app. My initial "serve" works but once I make a change and the project is rebuilt I have started crashing with the error stack shown later. I have to exit VS Code, restart VS Code and then I can get (exactly) one serve before the problem happens again.
I have read issue #13734 and have added a Windows (System) Environment variable of NODE_OPTIONS set to --max-old-space-size=8096. (I had previously been running successfully with the Node default). I have also tried modifying the scripts to do the same as seen below.
I have seen suggestions that this error could be caused by a Garbage Collection failure but since this is happening in the build ("serve") I have no way to implemement the suggested steps to "force a call to the GC".
🔬 Minimal Reproduction
VS Code 1.61.2
node 14.18.1
"@angular/compiler-cli": "^12.2.4",
"@nrwl/angular": "^12.8.0",
"@nrwl/cli": "12.8.0",
package.json:
"scripts": {
"ng": "node --max_old_space_size=8192 ./node_modules/.bin/ng",
"start": "node --max_old_space_size=8192 nx serve",
"build": "node --max_old_space_size=8192 ./node_modules/@angular/cli/bin/ng build",
"build-prod": "node --max_old_space_size=8192 ./node_modules/@angular/cli/bin/ng build --prod",
"test": "nx test",
"postinstall": "ngcc --properties es2015 browser module main"
},
npx nx serve my-app --poll=2000 --progress
🔥 Exception or Error
🌍 Your Environment
Windows 10
The text was updated successfully, but these errors were encountered: