VS Code Crash on Ubuntu: GPU Error and Memory Range Fixes
Visual Studio Code crashes on Ubuntu systems with an error message containing [ERROR:process_memory_range.cc(75)] read out of range
related to GPU process failures. This occurs specifically when running VS Code installed via Snap, particularly after updates to version 1.90 or later on Ubuntu 22.04 LTS (Jammy Jellyfish).
Cause
The GPU process crashes during startup due to compatibility issues between newer VS Code Snap packages and Ubuntu's display server configuration. This prevents VS Code from initializing correctly.
Solution 1: Use GPU Workaround Flag (Quick Fix)
Add the --in-process-gpu
flag when launching VS Code to force GPU operations into the main process:
code --in-process-gpu
To apply this permanently:
- Edit the desktop shortcut:bash
sudo nano /var/lib/snapd/desktop/applications/code_code.desktop
- Modify the
Exec
line to include the flag:iniExec=/usr/bin/snap run code --in-process-gpu %U
- Save the file and restart your desktop environment.
When to use: For a fast temporary fix while awaiting a patch. There are minor performance tradeoffs during GPU-intensive tasks.
Solution 2: Revert to Previous Snap Revision
If VS Code was installed via Snap and not fully purged, revert to a working version:
sudo snap revert code --revision 159
If code
was completely removed:
sudo snap install --revision 159 --classic code
Solution 3: Switch to Official .deb Package
If fixes above fail, remove Snap and install the Debian package:
Remove Snap version and config files:
bashsudo snap remove --purge code rm -r ~/.config/Code ~/.vscode
Install the package:
bashsudo apt install ./<downloaded-file>.deb
Solution 4: Manual Install of Older Version
Downgrade explicitly to version 1.89:
- Download v1.89 Snap package
- Install locally:bash
sudo snap install --classic ./code-stable-x64-1715063598.snap
Final Recommendations
- First try
--in-process-gpu
(Solution 1) - If unsuccessful, revert Snap revisions (Solution 2)
- For permanent resolution, install the .deb package (Solution 3)
These solutions address incompatibilities in Snap packaging. Monitor VS Code GitHub issues #212494 for official fixes in future releases.