Skip to content

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:

bash
code --in-process-gpu

To apply this permanently:

  1. Edit the desktop shortcut:
    bash
    sudo nano /var/lib/snapd/desktop/applications/code_code.desktop
  2. Modify the Exec line to include the flag:
    ini
    Exec=/usr/bin/snap run code --in-process-gpu %U
  3. 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:

bash
sudo snap revert code --revision 159

If code was completely removed:

bash
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:

  1. Remove Snap version and config files:

    bash
    sudo snap remove --purge code
    rm -r ~/.config/Code ~/.vscode
  2. Download the official .deb package

  3. Install the package:

    bash
    sudo apt install ./<downloaded-file>.deb

Solution 4: Manual Install of Older Version

Downgrade explicitly to version 1.89:

  1. Download v1.89 Snap package
  2. Install locally:
    bash
    sudo snap install --classic ./code-stable-x64-1715063598.snap

Final Recommendations

  1. First try --in-process-gpu (Solution 1)
  2. If unsuccessful, revert Snap revisions (Solution 2)
  3. 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.