Use the Memory inspector to inspect ArrayBuffer, TypedArray, and DataView memory in JavaScript as well as WebAssembly.Memory of Wasm applications written in C++.
Overview
The Memory inspector organizes memory content and helps you navigate large arrays quickly. You can view the ASCII values of memory content directly next to the bytes, and select different endianness. Use the Memory inspector while you debug your web app for an efficient workflow.
Open the Memory Inspector
There are a few ways to open the Memory inspector.
Open the demo-js.js file in the Sources panel, set a breakpoint at line 18.
Refresh the page.
Expand the Scope section on the right Debugger pane.
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.
Inspect multiple objects
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).
A new tab is opened in the Memory inspector. Please note that you can inspect multiple objects at once.
The Memory inspector
The Memory inspector consists of 3 main areas:
Navigation bar
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.
Memory buffers could be longer than a page. Instead of scrolling through, you can use the left and right button to navigate.
The buttons on the left allow a forward/backward navigation.
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
From the left, the address is displayed in hex format.
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).
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
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.
The main area shows all the value interpretations as per the settings. By default, all are shown.
The encoding is clickable. You can switch between dec, hex, oct for integer and sci, dec for floats.
Change the address to 0x00000027 in the address input.
Observe the ASCII representation and the value interpretations. All values are empty at the moment.
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.
Click on Resume script execution to step through the code.
Notice the ASCII representation is now updated. All the value interpretations are updated as well.
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.
Let's change the encoding from dec to sci. Notice the value representations are updated accordingly.
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-09-06 UTC."],[],[]]