Error reporting and solution of memory overflow of vscode running packaging Vue project

Time：2022-4-26

Error reporting and solution of memory overflow of vscode running packaging Vue project

Recently, when I was working on another old project, I found that the project was unusually large and involved a lot of contents, resulting in memory overflow when I was running. Although it did not affect the running of the code, it was very annoying when it was saved from time to time. There was no way, so I went to find various ways to solve it. The following are the problems encountered and some other people’s solutions

Final solution ——————– March 29, 2022

If the node version is too high, it can only be reinstalled once

I’m really speechless. I hope you can take a warning!!!!!!!!!!!!!!!!

You can refer to this installation tutorial:https://blog.csdn.net/lu6545311/article/details/123825809

———————————–

This is the problem. When the project is running, the memory overflows after clicking save. The project is too large

95% emitting
<--- Last few GCs --->

[21992:03DAAAD8]   186031 ms: Scavenge 728.6 (755.0) -> 728.5 (755.0) MB, 1.0 / 0.0 ms  (average mu = 0.997, current mu = 0.969) allocation failure
[21992:03DAAAD8]   186096 ms: Mark-sweep (reduce) 728.5 (755.0) -> 697.5 (744.6) MB, 64.4 / 0.0 ms  (average mu = 0.995, current mu = 0.990) last resort GC in old space requested
[21992:03DAAAD8]   186190 ms: Mark-sweep (reduce) 697.5 (732.6) -> 697.2 (716.8) MB, 93.9 / 0.0 ms  (average mu = 0.986, current mu = 0.000) last resort GC in old space requested

<--- JS stacktrace --->

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
npm ERR! code ELIFECYCLE
npm ERR! errno 134
npm ERR! [email protected] dev: webpack-dev-server --inline --progress --config build/webpack.dev.conf.js
npm ERR! Exit status 134
npm ERR!
npm ERR! Failed at the [email protected] dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\DELL\AppData\Roaming\npm-cache\_logs21-10-14T07_29_53_146Z-debug.log


terms of settlement

1. Increase memory at startup,
vue-cli2：

NPM run Dev and NPM run build are directly preceded by – max_ old_ space_ size=4096

 "scripts": {
"start": "npm run dev",
"dev": "node --max_old_space_size=4096 build/dev-server.js",
"build": "node --max_old_space_size=4096 build/build.js",
},


vue-cli3：
Install two NPM packages: increase memory limit and cross env
After installation, execute NPM run fix memory limit once, and then start NPM run serve

"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"fix-memory-limit": "cross-env LIMIT=4096 increase-memory-limit",
},


2. Then there is another way to installIncrease memory limit and cross env

Global install increase memory limit
npm install -g increase-memory-limit
npm install -g cross-env
Enter the project directory and execute:
npm run fix-memory-limit

Delete the following
node_ [email protected] Vue in cli. service. js
Manual deletion: - Max old space size = 6144

These are the above two methods. I hope they are useful to you

Achievable

"scripts": {
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
"start": "npm run dev",
"build": "node --max_old_space_size=4096 build/build.js"
},


P5131 Load and take fusion – count dp, combined count

This problem is a counting problem, which requires some optimization. simple idea From the title and data range, it can be guessed that the time complexity of the algorithm is about$$O(nk)$$, so it is not difficult to think of using dynamic programming:Assume$$f(i,j)$$before$$i$$selected number$$j$$total value ofThen the state transition equation is $f(i,j)=f(i-1,j)+f(i,j-1)\times a_i$ i.e. not […]