Skip to content
| Marketplace
Sign in
Visual Studio Code>Debuggers>MemoryLoupe - in-editor code size insightsNew to Visual Studio Code? Get it now.
MemoryLoupe - in-editor code size insights

MemoryLoupe - in-editor code size insights

plharraud

|
35 installs
| (0) | Free
codelenses about compiled executable symbol size and stack usage
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

MemoryLoupe

MemoryLoupe provides in-editor code size insights: codelenses about executable symbol size and stack usage.

Sample code with symbol codelenses

It parses gcc generated files produced when compiling and linking executable with the following options:

  • -Wl,-Map=%.map outputs .map file.
  • -fstack-usage outputs .su files.
  • -ffunction-sections and -fdata-sections separates symbols in their own section, enables garbage collection (using -Wl,--gc-sections), and produces usable data in .map file.

Features

codelenses provide symbol info such as

  • symbol code size
  • discarded or used status
  • function stack usage

Requirements

Requires an extension that provides symbol information (Outline panel in the Explorer tab): C/C++ or clangd

Usage

Open a C file, the codelenses should appear next to the symbols.

The extension activates, finds and parses .map and .su files witin the current workspace.

Commands

  • memoryloupe: Select build directory: Set the location where the files should be searched.
  • memoryloupe: Toggle codelenses: Enable/disable codelenses.

Settings

  • memoryloupe.codeLensesEnabled: Show codelenses next to symbols in source files
  • memoryloupe.buildDir: Directory to look for .map and .su files, also set by Select build directory command.
  • memoryloupe.lenseFormat: Custom codelense format string. Specify optional prefix with $[prefix]{value}.

Build

build the extension .vsix package

npm install
npm run vsix

Todo

  • alert if multiple .map found > button select or disable
  • tree view
  • use quickpicks instead of filepicker for selecting build dir
  • error handling and logging
  • tests
  • extension icon

Known Issues

  • duplicate symbols, not filtering by file: symbol information can be mismatched if there are multiple symbols with the same name, although this should not be possible
  • not tested on c++ project, although the extension activates for cpp files, it could work
  • only tested with bare-metal arm-none-eabi projects
  • only support utf-8 file encoding

Other tools

vscode extensions

  • https://github.com/XibrenX/gcc-stack-usage
  • https://github.com/nachstedt/vscode-stack-usage

cli tools

  • https://github.com/jedrzejboczar/elf-size-analyze
  • https://github.com/PromyLOPh/linkermapviz
  • https://os.mbed.com/docs/mbed-os/v6.16/debug-test/memap.html

gui tools

  • https://www.sikorskiy.net/info/prj/amap/index.html
  • https://github.com/govind-mukundan/MapViewer
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft