Overview Open Chrome DevTools What's New in DevTools DevTools tips Simulate mobile devices with Device Mode Performance insights: Get actionable insights on your website's performance Animations: Inspect and modify CSS animation effects Changes: Track your HTML, CSS, and JavaScript changes Coverage: Find unused JavaScript and CSS CSS Overview: Identify potential CSS improvements Issues: Find and fix problems Media: View and debug media players information Memory Inspector: Inspect ArrayBuffer, TypedArray, DataView, and Wasm Memory. Network conditions: Override the user agent string Security: Understand security issues Search: Find text across all loaded resources Sensors: Emulate device sensors WebAuthn: Emulate authenticators Engineering blog
Overview Open Chrome DevTools What's New in DevTools DevTools tips Simulate mobile devices with Device Mode Performance insights: Get actionable insights on your website's performance Animations: Inspect and modify CSS animation effects Changes: Track your HTML, CSS, and JavaScript changes Coverage: Find unused JavaScript and CSS CSS Overview: Identify potential CSS improvements Issues: Find and fix problems Media: View and debug media players information Memory Inspector: Inspect ArrayBuffer, TypedArray, DataView, and Wasm Memory. Network conditions: Override the user agent string Security: Understand security issues Search: Find text across all loaded resources Sensors: Emulate device sensors WebAuthn: Emulate authenticators Engineering blog

Memory Inspector: Inspect ArrayBuffer, TypedArray, DataView, and Wasm Memory.

Published on Updated on

The Memory Inspector panel is available from Chrome 91. You can check your version at chrome://version/.

Use the new Memory inspector to inspect ArrayBuffer, TypedArray, and DataView memory in JavaScript as well as WebAssembly.Memory of Wasm applications written in C++.

Open the Memory Inspector

There are a few ways to open the Memory inspector.

Open from the menu

  1. Open DevTools.
  2. Click More Options More > More tools > Memory inspector. Memory inspector menu

Open during debugging

  1. Open a page with JavaScript ArrayBuffer. We will be using this demo page.

  2. Open DevTools.

  3. Open the demo-js.js file in the Sources panel, set a breakpoint at line 18.

  4. Refresh the page.

  5. Expand the Scope section on the right Debugger pane.

  6. You can open the Memory inspector:

    • From the icon. Clicking on the icon next to the buffer property, or
    • From the context menu. Right click on the buffer property and select Reveal in Memory Inspector panel.
    Reveal in Memory Inspector panel

Inspect multiple objects

  1. You can inspect DataView or TypedArray as well. For example, b2 is a TypedArray. To inspect that, right click on the b2 property and select Reveal in Memory Inspector panel (No icon for TypedArray or DataView yet).
  2. A new tab is opened in the Memory inspector. Please note that you can inspect multiple objects at once. New tab in the Memory inspector

The Memory inspector

The Memory inspector

The Memory inspector consists of 3 main areas:

Navigation bar
  1. The address input shows the current byte address in hex format. You can input a new value to jump to a new location in the memory buffer. For example, try type 0x00000008.
  2. Memory buffers could be longer than a page. Instead of scrolling through, you can use the left and right button to navigate.
  3. The buttons on the left allow a forward/backward navigation.
  4. By default, the buffer is automatically updated on stepping. In the case it's not, the refresh button gives you the option to refresh the memory and update its contents.

Memory buffer

Memory buffer
  1. From the left, the address is displayed in hex format.
  2. The memory is also shown in hex format, each byte separated by a space. The currently selected byte is highlighted. You can click on the byte or navigate with keyboard (left, right, up, down).
  3. An ASCII representation of the memory is shown on the right side. A highlight shows the corresponding value to the selected bits on the byte. Similar to memory, you can click on the byte or navigate with keyboard (left, right, up, down).

Value inspector

Value inspector
  1. A top toolbar features a button to switch between big and little endian and to open the settings. Open the settings to select which value types they want to see per default in the inspector. toolbar button
  2. The main area shows all the value interpretations as per the settings. By default, all are shown.
  3. The encoding is clickable. You can switch between dec, hex, oct for integer and sci, dec for floats. Encoding switch

Inspecting memory

Let's inspect the memory together.

  1. Follow these steps to start the debugging.
  2. Change the address to 0x00000027 in the address input. address input
  3. Observe the ASCII representation and the value interpretations. All values are empty at the moment.
  4. Notice the blue Jump to address button next to Pointer 32-bit and Pointer 64-bit. You can click on it to jump to the address. The buttons are grayed out and not clickable if the addresses are not valid. Jump to address button
  5. Click on Resume script execution to step through the code. Resume script execution
  6. Notice the ASCII representation is now updated. All the value interpretations are updated as well. All value interpretations are updated
  7. Let's customize the Value inspector to show only floating point. Click on the settings button and check only Float 32-bit and Float 64-bit. settings to customize value inspector
  8. Let's change the encoding from dec to sci. Notice the value representations are updated accordingly. Change the encoding.
  9. Try to navigate the memory buffer with your keyboard or using the navigation bar. Repeat step 4 to observe values changes.

WebAssembly memory inspection

The WebAssembly.Memory object is an ArrayBuffer that holds the raw bytes of object memory. The Memory Inspector panel lets you inspect such objects in Wasm applications written in C++.

To take full advantage of WebAssembly.Memory inspection:

  • Use Chrome 107 or later. Check your version at chrome://version/.
  • Install the C/C++ DevTools Support (DWARF) extension. This is a plugin for debugging C/C++ WebAssembly applications using DWARF debug information.
  • Enable DWARF debugging in DevTools > Settings. Settings > Experiments > WebAssembly Debugging: Enable DWARF support and reload DevTools. Enabling DWARF support in the Experiments tab.

To inspect the WebAssembly.Memory of an object:

  1. Open DevTools on this demo page.

  2. In the Sources panel, open demo-cpp.cc and set a breakpoint in the main() function at line 15: x[i] = n - i - 1;.

  3. Reload the page to run the application. The debugger pauses at the breakpoint.

  4. In the Debugger pane, expand Scope > Local.

  5. Click the Reveal in Memory Inspector. icon next to the x: int[10] array.

    Alternatively, right-click the array and select Reveal in Memory Inspector panel.

The x array opened in Memory Inspector.
Gotchas

Starting from Chrome version 107, the Memory Inspector highlights all the bytes of a C/C++ memory object. This lets you tell them apart from the surrounding memory.

To stop highlighting object memory, in the Memory Inspector panel, hover over the object badge and click the x button.

Stop highlighting object memory.

To learn more, see:

Updated on Improve article

We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.