C Memory Visualizer is a VS Code extension for learning how C programs use memory. Each time the debugger pauses, you can inspect the memory layout of variables on the stack and in the data region, explore heap allocations, and follow pointers to their targets.
Requirements
Windows x64
A 64-bit C program built with DWARF debug information
Use one of the following debug setups. The debugger must support Python scripting.
Debugger
VS Code extension
launch.json type
LLDB
CodeLLDB
lldb
LLDB
LLDB DAP
lldb-dap
GDB
Microsoft C/C++
cppdbg with MIMode set to gdb
Build and debugger settings
For MinGW builds, compile with -g to include DWARF debug information. The table lists the settings specific to each setup.
Compiler and debugger
Build command
Additional launch.json settings
MinGW GCC + GDB (cppdbg)
—
—
MinGW Clang + MinGW LLDB (lldb-dap)
—
—
MinGW Clang + CodeLLDB (lldb)
—
Recommended: Set CodeLLDB to use the GNU ABI to match the MinGW build. "initCommands": ["settings set plugin.object-file.pe-coff.abi gnu"]
Before starting a debug session, open the Command Palette and run C Memory Visualizer: Open View.
Set a breakpoint in your C program and start debugging.
When the debugger pauses, search for a variable and select it to open its memory view. For a pointer, select Follow pointer to open its target.
Recommended: Use the VS Code debug toolbar or keyboard shortcuts to step or continue. With CodeLLDB, the debug session may stop responding if you continue from the Debug Console while the extension is collecting a snapshot.
View controls
Pan the view — Hold the right mouse button and drag.
Move a window — Drag its header with the left mouse button.
Zoom in or out — Hold Ctrl and scroll the mouse wheel.
Limitations
The extension supports C programs that run in a single process with a single thread.
Visualization of unions, bit-fields, and flexible array members is unsupported.
The Follow pointer button is disabled for pointers to functions.
When debugging a MinGW build with CodeLLDB, an ABI mismatch can cause long double to appear as __float128. See Build and debugger settings.