Visual Studio Code, rebuilt in Rust
Rust
#!/bin/bash
# Repeats a workload in the packaged app and fails when the window process's footprint keeps growing (issue 116):
# the median of the last 5 rounds over 1.3 times that of rounds 3 to 7. The workloads are in
# port/fixtures/extensions/memory-soak/tests/index.js. Run on the Studio after port/tools/package-app:
# port/tools/studio --lane 'port/tools/memory-soak' env MODE (browse, typing or all; default browse),
# ROUNDS (default 20, at least 10), FOLDER (default the VS Code 1.148.0 checkout), APP (default native/target/VSRustium.app),
# SETTINGS (the user settings.json, default the start editor and AI features off)
set -uo pipefail
APP=${APP:-$PWD/native/target/VSRustium.app}
FOLDER=${FOLDER:-$HOME/Developer/vscode-ref-1.148.0}
tests=$PWD/port/fixtures/extensions/memory-soak
source port/tools/gui-lock.sh
dir=$(mktemp -d)
trap 'rm -rf "$dir"; [[ -n ${PORT_GUI_LOCK_HELD:-} ]] || rm -rf /tmp/port-gui.lock' EXIT
settings='{"workbench.startupEditor":"none","chat.disableAIFeatures":true}'
mkdir -p "$dir/user-data/User" && echo "${SETTINGS:-$settings}" >"$dir/user-data/User/settings.json"
env -u VSCODE_GPUI_EXTENSIONS MODE=${MODE:-browse} ROUNDS=${ROUNDS:-20} "$APP/Contents/MacOS/vsrustium" "$FOLDER" --user-data-dir "$dir/user-data" \
--extensions-dir "$dir/extensions" --disable-workspace-trust --skip-welcome --extensionDevelopmentPath="$tests" --extensionTestsPath="$tests/tests" >"$dir/log" 2>&1
code=$?
grep -E '^(round|median)|^extension tests failed' "$dir/log"
echo "memory soak: exit $code"
exit $code