VSCode Memory
2025-01-07
A device hosting VSCode processes, experiences errors and can become unresponsive when process memory reaches or exceeds memory limits.
Increase memory avail to VSCode processes
VSCode is resource-intensive, comparatively, for simple, specialised tasks.
For more narrowly focused activities, like markdown editing, use dedicated apps with significantly smaller memory footprints than VSCode.
Increasing Node.js heap size.
Set NODE_OPTIONS env var before deploying dev servers:
export NODE_OPTIONS="--max-old-space-size=8192" // Set to 8GB
Use a Node.js memory profiling tool to gain more insight into app memory usage.
For SSG, adjust Nitro's perender
build config in `nuxt.config.ts for improved mem mgmt.
Increase UNIX soft memory limit for VSCode.
Invoke ulimit
before launching VSCode:
ulimit -S -m limited
code .
ulimit -H -m unlimited
code .
Adjust kernel parameters (like vm.max_map_count
and vm.swappiness
) to optimise memory usage.
Increase Swap space.
Solid-State-Drives Improve system responsiveness.
Upgrade CPU
Upgrade RAM
Restart VSCode to release memory.
Refresh code:
rm -rf node_modules .next[ or .nuxt or oth framework] .pnpm-lock
pnpm i
Tree-shake unused pkgs:
pnpm prune