Skip to content

Commit 356d3fd

Browse files
committed
docs(cpp/faq): clarify RAM disk guidance for IntelliSense cache (ipch)
1 parent 837754d commit 356d3fd

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

docs/cpp/faq-cpp.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,53 @@ This setting allows you to set a limit on the amount of caching the extension do
8383

8484
If you do not want to use the IntelliSense caching feature (such as to work around a bug that may only occur when the cache is enabled), you can disable the feature by setting the **IntelliSense Cache Size** setting to 0 (or `"C_Cpp.intelliSenseCacheSize": 0"` in the JSON settings editor). Disabling the cache may also be beneficial if you're seeing excessive disk writing, particularly when editing headers.
8585

86+
## Can I put the IntelliSense cache (ipch) on a RAM disk?
87+
88+
Yes. The C/C++ extension lets you relocate and limit the IntelliSense cache:
89+
90+
- **`C_Cpp.intelliSenseCachePath`** — where the `ipch` cache is stored
91+
- **`C_Cpp.intelliSenseCacheSize`** — maximum cache size in MB (set to `0` to disable)
92+
93+
By default, the cache lives under your user cache directory (Windows: `%LocalAppData%/Microsoft/vscode-cpptools`, Linux: `$XDG_CACHE_HOME/vscode-cpptools/` or `~/.cache/vscode-cpptools/`, macOS: `~/Library/Caches/vscode-cpptools/`). If you want to minimize SSD writes, you can mount a RAM-backed filesystem and point the cache there.
94+
However, using a RAM disk does not generally improve IntelliSense performance and may increase memory usage, since the cache files are already memory-mapped by the IntelliSense processes.
95+
96+
> **Notes**
97+
> - A RAM disk is volatile. The cache will be cleared on reboot/unmount (the cache will rebuild automatically).
98+
> - Set `C_Cpp.intelliSenseCacheSize` ≤ your RAM disk size.
99+
> - This is a per-user setting and works across all workspaces.
100+
> - If your main concern is reducing disk writes (e.g., SSD wear), you can also set `"C_Cpp.intelliSenseCacheSize": 0` to completely disable the cache instead of relocating it.
101+
102+
> **Related:** The tag parser “browse” database path can be customized with
103+
> `"C_Cpp.default.browse.databaseFilename"`. Moving it to a RAM disk is generally not recommended for performance, but the path can be changed if needed.
104+
105+
106+
107+
**macOS (APFS RAM disk, ~4 GB):**
108+
```bash
109+
diskutil erasevolume APFS "vsc-ipch" $(hdiutil attach -nomount ram://8388608)
110+
# Then set: "C_Cpp.intelliSenseCachePath": "/Volumes/vsc-ipch/cpptools-ipch"
111+
# Optionally: "C_Cpp.intelliSenseCacheSize": 2048
112+
```
113+
114+
**Linux (tmpfs, ~4 GB):**
115+
```bash
116+
sudo mkdir -p /mnt/vsc-ipch
117+
sudo mount -t tmpfs -o size=4G,mode=1777 tmpfs /mnt/vsc-ipch
118+
# Then set: "C_Cpp.intelliSenseCachePath": "/mnt/vsc-ipch/cpptools-ipch"
119+
```
120+
121+
122+
**Windows:**
123+
Windows doesn’t include a built-in RAM disk. If allowed, create one (for example with ImDisk) and set:
124+
```json
125+
"C_Cpp.intelliSenseCachePath": "R:\\vscode-cpptools\\ipch",
126+
"C_Cpp.intelliSenseCacheSize": 2048
127+
128+
```
129+
130+
131+
132+
86133
## How do I set up debugging?
87134

88135
The debugger needs to be configured to know which executable and debugger to use:

0 commit comments

Comments
 (0)