reactjs / reactjs/react.dev

Fatal error happens when compiling react. FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed.

Open
#2,237 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
11.8k
Forks
7.9k
Avg merge
1d 11h
Merged PRs (30d)
11

Description

When I try to compile my some not small react project, this error happens.
But, it is not always, and sometimes happens, sometimes not happens,
But along time goes, it happens more often.

There, node_modules\webpack\lib\Stats.js can be other js file, ex. formatLocation.js

Whenever this error happens, yarn service is terminated, and i should do 'yarn start' again.
Could you help me to fix this error?


Compiling...

<--- Last few GCs --->

[16224:000002AF7B7C2B00] 324452 ms: Mark-sweep 1320.5 (1444.2) -> 1306.6 (1442.7) MB, 440.9 / 0.0 ms (average mu = 0.219, current mu = 0.127) allocation failure scavenge might not succeed
[16224:000002AF7B7C2B00] 324998 ms: Mark-sweep 1324.4 (1442.7) -> 1315.9 (1441.2) MB, 465.5 / 0.1 ms (average mu = 0.183, current mu = 0.146) allocation failure scavenge might not succeed

<--- JS stacktrace --->

==== JS stack trace =========================================

0: ExitFrame [pc: 00000000B315C5C1]
1: StubFrame [pc: 00000000B315DB86]

Security context: 0x03fce051e6e9
2: /* anonymous /(aka / anonymous */) [0000000D1F8A6029] [MY_REACT_PROJECT_PATH\node_modules\webpack\lib\Stats.js:~540] [pc=00000000B4EF33D1](this=0x00e61e9826f1 ,reason=0x02c010a6c041 )
3: arguments adaptor frame: 3->1
4: map [000003FCE0506E61](this=0x022e...

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 00007FF72344C6AA v8::internal::GCIdleTimeHandler::GCIdleTimeHandler+4506
2: 00007FF723427416 node::MakeCallback+4534
3: 00007FF723427D90 node_module_register+2032
4: 00007FF72374189E v8::internal::FatalProcessOutOfMemory+846
5: 00007FF7237417CF v8::internal::FatalProcessOutOfMemory+639
6: 00007FF723927F94 v8::internal::Heap::MaxHeapGrowingFactor+9620
7: 00007FF72391EF76 v8::internal::ScavengeJob::operator=+24550
8: 00007FF72391D5CC v8::internal::ScavengeJob::operator=+17980
9: 00007FF723926317 v8::internal::Heap::MaxHeapGrowingFactor+2327
10: 00007FF723926396 v8::internal::Heap::MaxHeapGrowingFactor+2454
11: 00007FF723A50637 v8::internal::Factory::NewFillerObject+55
12: 00007FF723ACD826 v8::internal::operator<<+73494
13: 00000000B315C5C1
error Command failed with exit code 134.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported compilation failure and inspect the stack trace location in node_modules\webpack\lib\Stats.js around line 540. Compare the compile flow with the yarn start command and the supplied heap-error output; done means the React project compiles without terminating the yarn service.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs, react, webpack
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.