Hexo blog development-JavaScript heap out of memory

I. Overview

When writing a blog recently, errors often occur during compilation. The error message that appears is JavaScript head out of memorythat at first it was thought that the cache was too large (the blog occupies more than 4G). Using hexo cleaninstructions and clearing git cache files, the problem still exists

<!--more-->

Two phenomena

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 000000013FE1F04A v8::internal::GCIdleTimeHandler::GCIdleTimeHandler+5114
 2: 000000013FDFA0C6 node::MakeCallback+4518
 3: 000000013FDFAA30 node_module_register+2032
 4: 00000001400820EE v8::internal::FatalProcessOutOfMemory+846
 5: 000000014008201F v8::internal::FatalProcessOutOfMemory+639
 6: 00000001405A2BC4 v8::internal::Heap::MaxHeapGrowingFactor+9556
 7: 0000000140599C46 v8::internal::ScavengeJob::operator=+24310
 8: 000000014059829C v8::internal::ScavengeJob::operator=+17740
 9: 00000001405A0F87 v8::internal::Heap::MaxHeapGrowingFactor+2327
10: 00000001405A1006 v8::internal::Heap::MaxHeapGrowingFactor+2454
11: 000000014015CDB7 v8::internal::Factory::NewFillerObject+55
12: 00000001401F2CC6 v8::internal::WasmJs::Install+29414
13: 000001BEAF5DC5C1

 

Three solutions

Add in the scripts of the package.json file

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

 

Four results

Execute and hexo gcompile the project, without the above error, execute and hexo srun the project, and view the results of the project

 

Guess you like

Origin blog.csdn.net/Calvin_zhou/article/details/107850359