Skip to content

Excessive RAM usage / crash on Linux: webkit2gtk-4.0 2.47.x (unstable) + Tauri 1.x incompatibility on Fedora 42 #2907

@ddaikodaiko

Description

@ddaikodaiko

Environment

Field Value
OS Fedora 42 (Linux 6.19.14-101.fc42.x86_64)
Phoenix Code Desktop app (binary from installer)
Tauri version 1.8.1 (embedded in binary)
webkit2gtk linked libwebkit2gtk-4.0.so.37
webkit2gtk-4.0 version 2.47.2-3.fc42
webkit2gtk-4.1 version 2.52.3-1.fc42 (available but unused)

Problem

Phoenix Code consumes an extreme amount of RAM — often 700 MB–1.4 GB — and crashes/freezes the system, especially at startup when loading the editor.

Root Cause

This is a triple compatibility problem:

1. webkit2gtk-4.0 2.47.x is an unstable/development release

In GNOME/WebKit versioning, odd minor versions are development branches:

  • 2.46.x → stable (production)
  • 2.47.xunstable/development ← what Fedora 42 ships
  • 2.48.x → next stable

Fedora 42 is a cutting-edge distro that has already moved webkit2gtk4.0 to the 2.47.x development branch. This version introduces a new GPU process architecture and DMA-buf renderer that has known memory regressions on Linux/GTK, including:

  • DMA-buf renderer allocating GPU buffers that aren't properly released
  • GPU compositing layer memory not being freed under memory pressure
  • JavaScriptCore concurrent JIT accumulating compilation buffers during heavy JS load (like loading the full editor at startup)

2. Tauri 1.x cannot use the stable webkit2gtk-4.1

Phoenix Desktop uses Tauri 1.8.1, which only supports the webkit2gtk-4.0 API (GTK3). Tauri 2.x migrated to webkit2gtk-4.1 (GTK4), which is available in stable form on Fedora 42 (2.52.3). Since Phoenix hasn't migrated to Tauri 2 yet, it's forced to use the unstable 2.47.x webkit.

3. Heavy JS load amplifies the problem

The editor loads the full Brackets-based codebase as a single SPA in the WebView, with a large JS heap. This creates significant pressure on JavaScriptCore's JIT compiler exactly when webkit2gtk 2.47.x is least stable.

Memory breakdown (approximate)

Component Without workaround With workaround
WebKit DMA-buf GPU buffers 300–600 MB ~0
Compositing layers 150–300 MB ~0
JS heap (editor) 200–400 MB 200–400 MB
phnode (Node.js) 50–100 MB 50–100 MB
Total ~700 MB – 1.4 GB ~300–500 MB

Workaround (temporary)

Adding these environment variables to the launcher script (phcode.sh) significantly reduces memory usage:

#!/bin/bash
export WEBKIT_DISABLE_DMABUF_RENDERER=1
export WEBKIT_DISABLE_COMPOSITING_MODE=1
export JSC_useConcurrentJIT=0
/home/user/.phoenix-code/phoenix-code "$@"
  • WEBKIT_DISABLE_DMABUF_RENDERER=1 — disables the DMA-buf renderer that leaks in 2.47.x
  • WEBKIT_DISABLE_COMPOSITING_MODE=1 — disables GPU compositing, saves ~150–300 MB
  • JSC_useConcurrentJIT=0 — disables concurrent JIT, prevents buffer accumulation at startup

The installer could include these by default on Linux when webkit2gtk-4.0 < 2.48.0 is detected.

Proper fix

Migrate Phoenix Desktop from Tauri 1.x → Tauri 2.x. Tauri 2 uses webkit2gtk-4.1, which has a stable, modern version (2.52.3) on Fedora 42 and avoids this entire class of issues.

Relevant: https://v2.tauri.app/start/migrate/

Additional notes

  • The phcode.sh launcher script generated by the installer is empty (just calls the binary), so users have no way to set these flags without modifying it manually.
  • Also found minor memory leaks in src-node (pendingExecPromiseMap without timeout in node-connector.js, queuedReq Map not cleared on ESLint process restart in ESLint/service.js), but these are secondary compared to the WebKit issue above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions