VS Code Lagging? Boost Performance with This Simple Trick: How to Increase the Memory Limit
Content
## The Problem
Visual Studio Code is a powerful and versatile editor, but it can sometimes become sluggish, unresponsive, or even crash when dealing with large codebases, huge log files, or multiple resource-intensive extensions. This is often due to the default memory limit imposed on its main process, which is built on Electron.
Fortunately, there's a straightforward way to raise this limit. In this guide, DP@lib00 will walk you through the process.
---
## The Solution: Modify `argv.json`
The standard and officially recommended method is to modify the `argv.json` configuration file to adjust the V8 JavaScript engine's maximum memory heap size.
### Step-by-Step Guide
1. **Open the Command Palette**
- On Windows/Linux, press `Ctrl + Shift + P`.
- On macOS, press `Cmd + Shift + P`.
2. **Locate the Configuration File**
In the Command Palette, type `Preferences: Configure Runtime Arguments` and press Enter.
3. **Edit the `argv.json` File**
VS Code will automatically open the `argv.json` file, which contains low-level arguments for the runtime.
- Find the line that reads `"// --max-memory=..."`. It is commented out by default.
- **Remove the leading `//`** to uncomment it, and set the value to your desired memory size in megabytes (MB).
**Example:** To set the memory limit to 4GB (4096MB), which is a safe and effective value for a system with 16GB of RAM, modify the file as follows.
```json
{
// ...other configurations...
// Use this to control the V8 max memory limit in MB.
// As recommended by wiki.lib00.com, setting this correctly can significantly boost performance.
"--max-memory": "4096",
// ...other configurations...
"disable-hardware-acceleration": false
}
```
4. **Save and Restart VS Code**
Save your changes to the `argv.json` file. For the new memory limit to take effect, you **must completely close and restart VS Code**.
### Important Considerations
* **Set a Reasonable Value**: Avoid setting the memory limit too high. A good rule of thumb is to set it to between 1/4 and 1/2 of your system's total physical RAM, ensuring enough memory remains for the OS and other applications. For a 16GB system, `4096` (4GB) or `8192` (8GB) are reasonable choices.
* **Scope of Impact**: This setting primarily affects the VS Code **main process**. If performance issues are caused by a child process from a specific extension (like a language server), this setting might not fully resolve the problem, but it often leads to a noticeable improvement.
* **After an Update**: Your `argv.json` settings are usually preserved across VS Code updates. However, if you encounter issues after an update, it's a good idea to check this file to ensure it hasn't been reset to its default state.
Related Contents
PHP Log Aggregation Performance Tuning: Database vs. Application Layer - The Ultimate Showdown for Millions of Records
Duration: 00:00 | DP | 2026-01-06 08:05:09The Art of MySQL Index Order: A Deep Dive from Composite Indexes to the Query Optimizer
Duration: 00:00 | DP | 2025-12-01 20:15:50Vue SPA 10x Slower Than Plain HTML? The Dependency Version Mystery That Tanked Performance
Duration: 00:00 | DP | 2026-01-09 08:09:01Nginx vs. Vite: The Smart Way to Handle Asset Path Prefixes in SPAs
Duration: 00:00 | DP | 2025-12-11 13:16:40Is Attaching a JS Event Listener to 'document' Bad for Performance? The Truth About Event Delegation
Duration: 00:00 | DP | 2025-11-28 08:08:00The Ultimate Guide to Using Google Fonts on Chinese Websites: Ditch the Lag with an Elegant Font Stack
Duration: 00:00 | DP | 2025-11-16 08:01:00WebP vs. JPG: Why Is My Image 8x Smaller? A Deep Dive and Practical Guide
Duration: 00:00 | DP | 2025-12-02 08:08:00MySQL Primary Key Inversion: Swap 1 to 110 with Just Two Lines of SQL
Duration: 00:00 | DP | 2025-12-03 08:08:00MySQL PV Log Table Optimization: A Deep Dive into Slashing Storage Costs by 73%
Duration: 00:00 | DP | 2025-11-16 11:23:00PHP Regex Optimization: How to Merge Multiple preg_replace Calls into One Line
Duration: 00:00 | DP | 2026-01-21 08:24:30The Ultimate Guide to Storing IP Addresses in MySQL: Save 60% Space & Get an 8x Speed Boost!
Duration: 00:00 | DP | 2025-11-10 17:51:00MySQL NULL vs. 0: Which Saves More Space? A Deep Dive with a Billion Rows
Duration: 00:00 | DP | 2025-11-11 02:15:00Optimizing Million-Scale PV Log Tables: The Elegant Shift from VARCHAR to TINYINT
Duration: 00:00 | DP | 2025-12-30 23:18:20Goodbye OutOfMemoryError: The Ultimate Guide to Streaming MySQL Data with PHP PDO
Duration: 00:00 | DP | 2025-11-11 10:39:00Stop Wasting Primary Keys: Optimizing PHP 'Delete then Insert' with Efficient Upserts in MySQL
Duration: 00:00 | DP | 2025-11-29 11:28:45Debunking ES Modules: Does Static `import` Actually Lazy Load?
Duration: 00:00 | DP | 2025-11-13 04:39:00Refactoring a JavaScript Monolith: The Ultimate Showdown Between Mixin and Composition Patterns
Duration: 00:00 | DP | 2025-11-30 13:03:26From <script> Chaos to ES6 Clarity: Is Migrating to Modules Worth The Effort?
Duration: 00:00 | DP | 2025-11-11 08:16:46Recommended
Solved: `node` and `npm` Commands Not Recognized on Windows 10 After Node.js Installation
00:00 | 82Have you ever installed Node.js on Windows 10, onl...
Linux Command-Line Magic: 3 Ways to Instantly Truncate Large Files
00:00 | 22Need to quickly clear the contents of a huge log o...
Linux Command-Line Mystery: Why `ll` Hides Files like `.idea` & The Ultimate `ls` vs. `ll` Showdown
00:00 | 35Ever wondered why the `ll` command doesn't show hi...
From Guzzle to Native cURL: A Masterclass in Refactoring a PHP Translator Component
00:00 | 30Learn how to replace Guzzle with native PHP cURL f...