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
macOS RAM Disk Deep Dive: Is Memory Allocation Dynamic or Fixed?
Duration: 00:00 | DP | 2026-07-09 20:02:36VS Code PHP Guide: How to Trace Function Definitions Like PHPStorm
Duration: 00:00 | DP | 2026-07-04 20:27:00Ultimate Guide to PHP 8.4 Image Compression: Why libvips Beats GD and Imagick for High-Traffic Apps
Duration: 00:00 | DP | 2026-07-10 20:07:48Efficient Vue.js Development in VS Code: Essential Plugins and Ultimate Guide to Fix Code Navigation Issues
Duration: 00:00 | DP | 2026-07-11 08:10:24Ultimate Guide: How to Export Markdown Preview to PDF in VS Code
Duration: 00:00 | DP | 2026-07-23 09:12:53PHP 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:40Boost Your VS Code Productivity: Select All Occurrences in a Single Keystroke!
Duration: 00:00 | DP | 2026-06-27 14:25:00Is 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:00Recommended
Nginx vs. Vite: The Smart Way to Handle Asset Path Prefixes in SPAs
00:00 | 140When deploying a Single Page Application (SPA) bui...
The Ultimate Guide to Pagination SEO: Mastering `noindex` and `canonical`
00:00 | 144Website pagination is a common SEO challenge. Mish...
'claude' Command Not Found on Windows? Master Your npm Global Path Setup
00:00 | 7Encountering the "'command not found'" error in Po...
Nginx Redirect Trap: How to Fix Incorrectly Encoded Ampersands ('&') in URLs?
00:00 | 120Have you ever encountered an issue where the amper...