Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>SafeCpp — Memory Safety AnalyzerNew to Visual Studio Code? Get it now.
SafeCpp — Memory Safety Analyzer

SafeCpp — Memory Safety Analyzer

Vatsal Khosla

|
28 installs
| (0) | Free
Real-time C++ memory safety analysis: use-after-free, null dereferences, memory leaks, and cross-function UAF. Requires the safecpp binary on PATH — see https://safecpp.dev for install instructions.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

SafeCpp — VS Code Extension

Real-time C++ memory safety analysis powered by SafeCpp and Clang LibTooling.

Features

  • Squiggly underlines on use-after-free, null dereferences, memory leaks, and cross-function UAF — inline, as you save
  • Hover tooltips explaining what went wrong and how to fix it
  • Problems panel integration (Ctrl+Shift+M) showing all findings across your project
  • Status bar showing issue count — click to open the full HTML report
  • Related information links: for UAF, the error points to the use site and a related location link shows the free site
  • Dark/light theme in HTML reports

Requirements

The safecpp binary is required. The extension will automatically prompt to install it on first use — just click Install when the dialog appears.

Manual install (Linux):

curl -sSL https://github.com/VatsalKhosla/SafeCpp/releases/latest/download/safecpp-linux-x86_64.tar.gz \
  | tar xz -C ~/.local/bin

Windows users: Native Windows binaries are not yet available. Use the Remote - WSL extension to open your project inside WSL, then install the Linux binary there.

macOS users: macOS binaries are not yet available. Build from source or watch releases for updates.

Usage

  1. Open any .cpp or .c file
  2. Save it — analysis runs automatically
  3. See squiggly underlines for any violations
  4. Check the Problems panel (Ctrl+Shift+M) for the full list
  5. Click the SafeCpp: N issues status bar item to open the HTML report

Commands

Command Description
SafeCpp: Analyze Current File Run on the active file
SafeCpp: Analyze Workspace Run on all C/C++ files in workspace
SafeCpp: Open HTML Report Open last report in browser
SafeCpp: Clear All Diagnostics Remove squiggly lines

Settings

Setting Default Description
safecpp.binaryPath "safecpp" Path to binary
safecpp.runOnSave true Auto-analyze on save
safecpp.compileCommandsPath "" Path to compile_commands.json
safecpp.autoDetect true Auto-detect build system
safecpp.severityThreshold "warning" Minimum severity to show
safecpp.configFile "" Path to .safecpp.json

Example

void example() {
    int* ptr = new int(42);
    delete ptr;
    int val = *ptr;  // ← red squiggly: use-after-free
    //  SafeCpp: Use-after-free: 'ptr' freed at line 3, used here
}
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft