question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Potential memory leak of `vue-tsc --noEmit -w`

See original GitHub issue

Reproduction

  1. pnpm create vite bug-vue-tsc
  2. select vue and vue-ts
  3. pnpm i vue-tsc@latest -D
  4. NODE_OPTIONS='--max_old_space_size=700' pnpm exec vue-tsc --noEmit -w
  5. Modify any code of App.vue and wait for the watch process response.
  6. Repeat step 5 for about 7 times and the process will OOM 🤔

FYI: I tried setting max_old_space_size to 2000 but still crash about 18 times of modification. Use htop to inspect I find the memory of the process keeps growing 🤔.

<--- Last few GCs --->

[2461:0x7f9d08008000]    36171 ms: Mark-sweep 697.9 (714.9) -> 696.7 (714.7) MB, 284.8 / 0.0 ms  (average mu = 0.128, current mu = 0.028) allocation failure scavenge might not succeed
[2461:0x7f9d08008000]    36416 ms: Mark-sweep (reduce) 699.0 (714.7) -> 698.6 (713.7) MB, 39.8 / 0.0 ms  (+ 145.5 ms in 31 steps since start of marking, biggest step 5.7 ms, walltime since start of marking 197 ms) (average mu = 0.182, current mu = 0.244) 

<--- JS stacktrace --->

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
 1: 0x1070a2a25 node::Abort() (.cold.1) [/Users/fi3ework/Library/Application Support/fnm/node-versions/v16.14.0/installation/bin/node]
 2: 0x105d980f9 node::Abort() [/Users/fi3ework/Library/Application Support/fnm/node-versions/v16.14.0/installation/bin/node]
 3: 0x105d9826f node::OnFatalError(char const*, char const*) [/Users/fi3ework/Library/Application Support/fnm/node-versions/v16.14.0/installation/bin/node]
 4: 0x105f19787 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/Users/fi3ework/Library/Application Support/fnm/node-versions/v16.14.0/installation/bin/node]
 5: 0x105f19723 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/Users/fi3ework/Library/Application Support/fnm/node-versions/v16.14.0/installation/bin/node]
 6: 0x1060bae05 v8::internal::Heap::FatalProcessOutOfMemory(char const*) [/Users/fi3ework/Library/Application Support/fnm/node-versions/v16.14.0/installation/bin/node]
 7: 0x1060b978c v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpaceÏ v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/Users/fi3ework/Library/Application Support/fnm/node-versions/v16.14.0/installation/bin/node]
 8: 0x1060c6030 v8::internal::Heap::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/Users/fi3ework/Library/Application Support/fnm/node-versions/v16.14.0/installation/bin/node]
 9: 0x1060c60b1 v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/Users/fi3ework/Library/Application Support/fnm/node-versions/v16.14.0/installation/bin/node]
10: 0x106093147 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/Users/fi3ework/Library/Application Support/fnm/node-versions/v16.14.0/installation/bin/node]
11: 0x10644ad4e v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/Users/fi3ework/Library/Application Support/fnm/node-versions/v16.14.0/installation/bin/node]
12: 0x1067f4819 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_NoBuiltinExit [/Users/fi3ework/Library/Application Support/fnm/node-versions/v16.14.0/installation/bin/node]
13: 0x10b169ab7 
14: 0x10b1fa2e4 
15: 0x10b0f8099 
16: 0x10ac789e8 
17: 0x10b16ea97 
18: 0x10ad30528 
 ERR_PNPM_RECURSIVE_EXEC_FIRST_FAIL  Command was killed with SIGABRT (Aborted): /Users/fi3ework/Downloads/test1/node_modules/.bin/vue-tsc --noEmit -w

Expected behavior

Do not leak memory.

System info

npx envinfo --system --npmPackages vue-tsc --binaries --browsers

  System:
    OS: macOS 12.3
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 543.25 MB / 32.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.14.0 - ~/Library/Caches/fnm_multishells/51303_1648175932312/bin/node
    Yarn: 1.22.18 - ~/Library/Caches/fnm_multishells/51303_1648175932312/bin/yarn
    npm: 8.3.1 - ~/Library/Caches/fnm_multishells/51303_1648175932312/bin/npm
  Browsers:
    Chrome: 99.0.4844.83
    Firefox: 98.0.2
    Safari: 15.4
  npmPackages:
    vue-tsc: ^0.33.7 => 0.33.7 

Package manager

pnpm@^6

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
kevinvalkcommented, Jun 29, 2022

Like @PatrickRose mentioned, I am observing the same memory leaking behavior (running within docker container).

However, we are using the vite-plugin-checker to run vue-tsc. On every reload the memory consumption of the node process grows a bit and will go out of memory after a certain number of reloads. But it seems that more people in https://github.com/fi3ework/vite-plugin-checker/issues/127 are suffering from this issue and it looks like the leak is occurring in vue-tsc.

Configuration:

...
export default defineConfig({
	plugins: [
		...
		checker({ vueTsc: true, enableBuild: false }),
	],
...
/app $ npx envinfo --system  --binaries --browser 

  System:
    OS: Linux 5.10 Alpine Linux
    CPU: (4) arm64 unknown
    Memory: 2.27 GB / 6.77 GB
    Container: Yes
    Shell: 1.35.0 - /bin/ash
  Binaries:
    Node: 16.15.1 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 8.11.0 - /usr/local/bin/npm

/app $ yarn list --pattern vue-tsc
yarn list v1.22.19
└─ vue-tsc@0.38.2
0reactions
lmcsucommented, Jul 8, 2022

The same. After multiple savings it dies the same way. OS: Ubuntu LTS

Read more comments on GitHub >

github_iconTop Results From Across the Web

Avoiding Memory Leaks - Vue.js
If you are developing applications with Vue, then you need to watch out for memory leaks. This issue is especially important in Single...
Read more >
Optimizing TypeScript Memory Usage - Swatinem
Using the latest lib version and target, with node modules, and without generating any emit output. The diagnostics option is the same as...
Read more >
eUv - River Thames Conditions - Environment Agency - GOV.UK
Duchman family winery foreclosure, Cosign student loan with bad credit, Ihsahn angl review, Montreal quebec tourist information, Dp g4 regulator leak, ...
Read more >
Vue CLI's type checking service ignores memory limits
We use a standard @vue/cli project, with TypeScript. However, the TS type checking service ignores all attempts to limit its memory usage, which ......
Read more >
Minimal TypeScript
If you fill your code with type annotations everywhere, tsc will definitely catch way more instances of potential trouble, but not that many ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found