Skip to content

Commit edaeea8

Browse files
committed
C++ FAQ: add RAM disk option for IntelliSense ipch cache (paths, size, OS examples)
1 parent 837754d commit edaeea8

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

docs/cpp/faq-cpp.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,27 @@ 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 and speed up access, you can mount a RAM-backed filesystem and point the cache there.
94+
95+
> **Notes**
96+
> - A RAM disk is volatile. The cache will be cleared on reboot/unmount (the cache will rebuild automatically).
97+
> - Set `C_Cpp.intelliSenseCacheSize` ≤ your RAM disk size.
98+
> - This is a per-user setting and works across all workspaces.
99+
100+
**macOS (APFS RAM disk, ~4 GB):**
101+
```bash
102+
diskutil erasevolume APFS "vsc-ipch" $(hdiutil attach -nomount ram://8388608)
103+
# Then set: "C_Cpp.intelliSenseCachePath": "/Volumes/vsc-ipch/cpptools-ipch"
104+
# Optionally: "C_Cpp.intelliSenseCacheSize": 2048
105+
106+
86107
## How do I set up debugging?
87108

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

0 commit comments

Comments
 (0)