vscode-copilot-release icon indicating copy to clipboard operation
vscode-copilot-release copied to clipboard

GitHub Copilot Extension Host Memory Crash - JS Heap Out of Memory

Open caelum0x opened this issue 6 months ago • 10 comments

GitHub Copilot Extension Host Memory Crash - JS Heap Out of Memory

Bug Summary

GitHub Copilot consistently crashes VS Code's extension host with "JavaScript heap out of memory" errors, making the extension unusable. This issue persists across different operating systems, VS Code versions, and even after complete reinstallation.

Type

Bug - Critical

Extension Information

  • GitHub Copilot Extension Version: Latest (as of June 2025)
  • GitHub Copilot Chat Extension Version: Latest (as of June 2025)
  • VS Code Version: Multiple versions tested
  • OS: Tested on both Windows 11 and Linux
  • GitHub Account: Student Pro subscription (confirmed active)

Detailed Description

The extension host crashes repeatedly with memory exhaustion errors. The crash occurs consistently regardless of:

  • Operating system (Windows 11 → Linux migration didn't resolve)
  • VS Code version (including Insiders)
  • Complete uninstall/reinstall of extensions
  • Fresh VS Code installation
  • Different project types/sizes

Error Logs

log.ts:460   ERR Extension host (LocalProcess pid: 3721) terminated unexpectedly. Code: 133, Signal: unknown

<--- Last few GCs --->[3721:0x112c000c4000]  1775888 ms: Mark-Compact 1918.0 (2122.5) -> 1917.1 (2121.8) MB, pooled: 9 MB, 190.66 / 0.00 ms  (average mu = 0.881, current mu = 0.056) allocation failure; scavenge might not succeed

[3721:0618/152812.069868:ERROR:node_bindings.cc(178)] OOM error in V8: Reached heap limit Allocation failed - JavaScript heap out of memory

sparseMultilineTokens.ts:582 Invalid Semantic Tokens Data From Extension: end character > model.getLineLength(lineNumber)

log.ts:460   ERR Overlapping ranges are not allowed!: Error: Overlapping ranges are not allowed!
    at pre.applyEdits (vscode-file://vscode-app/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:255:526)
    at hf.Ab (vscode-file://vscode-app/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:272:1097)

Steps to Reproduce

  1. Install GitHub Copilot and GitHub Copilot Chat extensions
  2. Open any project (tested with Web3/blockchain projects containing Solidity, TypeScript, Python)
  3. Use Copilot for code suggestions or chat interactions
  4. Extension host crashes within minutes to hours of usage
  5. VS Code automatically restarts extension host
  6. Cycle repeats continuously

Expected Behavior

  • GitHub Copilot should function normally without memory leaks
  • Extension host should remain stable during extended coding sessions
  • Memory usage should be reasonable and not grow indefinitely

Actual Behavior

  • Extension host crashes with OOM errors
  • Memory usage grows continuously until system limits are reached
  • Copilot becomes completely unusable
  • VS Code performance degrades significantly before crashes

Related Issues

This appears to be related to the source-map-support memory leak documented in community discussions, where source maps are cached indefinitely until the extension host terminates.

System Information

Windows 11 (Primary Testing Environment)

  • OS: Windows 11
  • VS Code: Multiple versions including latest stable and Insiders
  • RAM: 16GB+ (sufficient for normal VS Code usage)
  • Node.js: Latest LTS

Linux (Secondary Testing Environment)

  • OS: Various Linux distributions
  • VS Code: Fresh installation
  • Same memory crash behavior observed

Impact

  • Severity: Critical - Extension is completely unusable
  • Scope: Affects core Copilot functionality
  • User Type: Student developer working on Web3/blockchain applications
  • Duration: Issue persists for 3-4 days across multiple troubleshooting attempts

Troubleshooting Attempted

Tried (No Success):

  • Complete uninstall/reinstall of Copilot extensions
  • Fresh VS Code installation
  • Operating system migration (Windows → Linux)
  • VS Code Insiders testing
  • Memory limit adjustments (--max-memory=8192)
  • Node.js environment variable tuning
  • Extension isolation and selective loading
  • Workspace exclusion configuration
  • Authentication reset and re-login
  • Different GitHub accounts testing

Workaround Found

Rolling back to GitHub Copilot extension versions from December 2024 or earlier resolves the issue, confirming this is a regression in recent releases.

Request

Please investigate the memory leak in the source-map-support dependency and provide a fix for the current extension versions. This issue is blocking development workflow for users who rely on GitHub Copilot for productivity.

Additional Context

  • Issue appears to affect both individual developers and teams
  • Related to recent v1.101 May 2025 release changes
  • Memory profiling suggests indefinite caching of source code/maps
  • Consistent across different programming languages and project types

caelum0x avatar Jun 19 '25 11:06 caelum0x

I've started having this consistently within the last week. Not sure what changed but I'm now having JS memory errors, crashing, and the extension just failing and resetting entirely (like it wasn't even used).

CyanideX avatar Jun 21 '25 05:06 CyanideX

It started me on windows even tho I tried every solution thats recommended and also uninstall it nothing worked.So I switch windows to linux first couple days same problem occured then it resolved somehow

caelum0x avatar Jun 21 '25 07:06 caelum0x

the same problem here, I increased the memory that was fixed at 4gb to 16gb and it's the same, I did all those steps above and nothing, out of curiosity it looked like this when they updated the limited requests

I increased it to pro+ and it seems to have gotten worse, I can't use it!!!

Aventura123 avatar Jun 22 '25 20:06 Aventura123

Problem seemed to be fixed on linux for me but proably due to latest update I started not be able to use many models even tho I am a pro model user due to student account benefits only I can freelly use gpt 4.1 and overall context seems to be lower because none of the models I tried is not be bale to done stuff that they used to can so proably they limited context and also models

caelum0x avatar Jun 24 '25 10:06 caelum0x

If you're a pro model user due to student account, you've probably lost access because of the request limit imposed, however, in my case, I'm a pro+ user with requests still available and I only started getting this problem after the update that imposed the request limits.

4.1 is the only one that doesn't have a limit, I don't know if it's only available to you because you're a student account or if you've exceeded an assigned limit.

For now I'm working with versions from 1 month ago because I'm paying for a resource that used to consume requests but gave an error and didn't finish the service...

Aventura123 avatar Jun 24 '25 10:06 Aventura123

Additional (if it helps): I use macOS 12.7.6, i was constantly getting this error until I removed and re-installed fresh which worked for sometime until I started installing back the earlier plugins. So, currently I'm having to use it with only the following installed with the freshly installed VS Code..

Image

sijojlouis avatar Jun 30 '25 08:06 sijojlouis

Sorry for the delay in responding here, for users still affected please follow the steps below to capture a cpu profile with gc stats

  1. Close all running instances of the application
  2. Start the application with the following flags code --trace --trace-category-filter="renderer,blink,gpu,v8,disabled-by-default-v8.cpu_profiler,disabled-by-default-v8.gc,disabled-by-default-v8.gc_stats"
  3. Once the crash happens
  4. Open command palette and run Developer: Stop Tracing

This will generate a trace file that you can attach to this issue

deepak1556 avatar Jul 10 '25 19:07 deepak1556

I was able to fix it by opening /etc/profile on alpine distro and adding export NODE_OPTIONS="--max-old-space-size=4096"

SPWizard01 avatar Oct 11 '25 14:10 SPWizard01

Hey @deepak1556, I have encountered an exact issue: I have been using github copilot pro with student benefit's plan and i haven't encountered this issue until i run out of the monthly permitted premium requests and after a day of limits hit, i added a new budget and from then whenever my github copilot do some heavy agentic multi-file edits(specially with gpt 5 models) the extension host will be terminated unexpectedly with the 'js heap out of memory' error.

I have read similar issues but unfortunately i haven't found any solutions yet.

Any help would be appreciated @deepak1556

dagmfre avatar Oct 26 '25 17:10 dagmfre

I have only encountered this issue in WSL, hence my fix. On my main PC running Win11 Insiders I do not have this issue. I do however have this issue with any WSL distro that I run, but exporting NODE_OPTIONS helps.

SPWizard01 avatar Oct 26 '25 17:10 SPWizard01

This issue has been closed as it has been labeled with info-needed and has not received the additional information that was requested from the issue author. It has been labeled as info-needed for 7 days.

I have the same issue when pasting few screenshots in the copilot

peter-mw avatar Dec 16 '25 14:12 peter-mw