Vite out of memory
See original GitHub issueDescribe the bug
I am consistently getting out of memory. It increases with the amount of changes I do to my ts files. If I change them a lot, it can run out of memory in like 30 minutes. If I just keep it running and don’t work on anything it runs fine for days, weeks even.
We do have one custom plugin which does babel transpilation, it is this one: https://github.com/capaj/vite-lingui-poc/blob/master/reactBabelRefreshPlugin.js
Reproduction
sadly I only get this on a codebase I cannot share. I am using vite.js daily and I plan to do so for the next few years so I will close this issue myself if the problem goes away.
System Info
System:
OS: Linux 5.11 Ubuntu 21.04 (Hirsute Hippo)
CPU: (24) x64 AMD Ryzen 9 5900X 12-Core Processor
Memory: 12.61 GB / 62.81 GB
Container: Yes
Shell: 5.8 - /usr/bin/zsh
Binaries:
Node: 12.20.1 - ~/.nvm/versions/node/v12.20.1/bin/node
Yarn: 1.22.4 - ~/.yarn/bin/yarn
npm: 6.14.10 - ~/.nvm/versions/node/v12.20.1/bin/npm
Browsers:
Brave Browser: 75.0.66.100
Chrome: 91.0.4472.114
Firefox: 89.0.2
npmPackages:
vite: ^2.3.8 => 2.3.8
Used Package Manager
npm
Logs
<--- Last few GCs --->
[1639247:0x3544f70] 78191678 ms: Scavenge 5985.8 (6006.8) -> 5985.3 (6006.8) MB, 23.6 / 0.0 ms (average mu = 0.215, current mu = 0.162) allocation failure
[1639247:0x3544f70] 78191707 ms: Scavenge 5985.8 (6006.8) -> 5985.3 (6007.5) MB, 20.1 / 0.0 ms (average mu = 0.215, current mu = 0.162) allocation failure
[1639247:0x3544f70] 78195078 ms: Mark-sweep 5986.2 (6007.5) -> 5984.1 (6007.0) MB, 3344.5 / 0.0 ms (average mu = 0.233, current mu = 0.249) allocation failure scavenge might not succeed
<--- JS stacktrace --->
==== JS stack trace =========================================
0: ExitFrame [pc: 0x140a8f9]
1: StubFrame [pc: 0x1473b2a]
Security context: 0x0fe9e0cc08d1 <JSObject>
2: mark [0x2785c9df3649] [/home/capaj/work-repos/looop/project-alpha/node_modules/@babel/core/node_modules/@babel/generator/lib/source-map.js:62] [bytecode=0x1732e9e4ef11 offset=100](this=0x204e67ca5d99 <SourceMap map = 0xe9bfb3bf229>,115,12,105,8,0x1bd980ac01b9 <null>,0x1bd980ac04b1 <undefined>,0x1bd980ac06e9 <false>)
3: ...
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 0xa18150 node::Abort() [node]
2: 0xa1855c node::OnFatalError(char const*, char const*) [node]
3: 0xb9715e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
4: 0xb974d9 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
5: 0xd54755 [node]
6: 0xd54de6 v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [node]
7: 0xd616a5 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [node]
8: 0xd62555 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
9: 0xd6500c v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
10: 0xd3d346 v8::internal::Factory::CopyJSObjectWithAllocationSite(v8::internal::Handle<v8::internal::JSObject>, v8::internal::Handle<v8::internal::AllocationSite>) [node]
11: 0x107262a [node]
12: 0x1075854 [node]
13: 0x1076c33 v8::internal::Runtime_CreateObjectLiteral(int, unsigned long*, v8::internal::Isolate*) [node]
14: 0x140a8f9 [node]
### Validations
- [X] Follow our [Code of Conduct](https://github.com/vitejs/vite/blob/main/CODE_OF_CONDUCT.md)
- [X] Read the [Contributing Guidelines](https://github.com/vitejs/vite/blob/main/.github/contributing.md).
- [X] Read the [docs](https://vitejs.dev/guide).
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/vue-next instead.
- [X] Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/vitejs/vite/discussions) or join our [Discord Chat Server](https://chat.vitejs.dev/).
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
vite build error: out of memory · Issue #2433 - GitHub
It looks like a memory leak to me. I've tried starting from a clean project and gradually added my code to it in...
Read more >Vite & Typescript: Yarn workspace commands running out of ...
I'm now running into what looks like some kind of memory leak when building and running tests. I'm using Typescript and Vite for...
Read more >How to Fix JavaScript Heap Out of Memory Error - MakeUseOf
How to Fix JavaScript Heap Out of Memory on Windows · Open the Start menu, search for Advanced System Settings, and select the...
Read more >Building for Production - Vite
Check out the Deploying a Static Site for guides about popular services. Browser Compatibility #. The production bundle assumes support for modern JavaScript....
Read more >Understanding memory leaks in Node.js apps - LogRocket Blog
The guaranteed memory allocation to the new instance means that the object will live forever. The application will eventually run out of memory...
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 Free
Top 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
closing as response is missing from code owners. reopening if response comes back
Hey guys, sorry for not responding. Unfortunately we are not able to recreate this issue as we are not using Vite anymore. Sorry, keep it closed.