Overview Open Chrome DevTools Get Started With Viewing And Changing The DOM Find Unused JavaScript And CSS With The Coverage Tab Find and fix problems with the Issues tab Run commands in the Command Menu View and debug media players information Emulate authenticators and debug WebAuthn Edit files with Workspaces Debug Progressive Web Apps Understand security issues Keyboard shortcuts View page resources
Overview Open Chrome DevTools Get Started With Viewing And Changing The DOM Find Unused JavaScript And CSS With The Coverage Tab Find and fix problems with the Issues tab Run commands in the Command Menu View and debug media players information Emulate authenticators and debug WebAuthn Edit files with Workspaces Debug Progressive Web Apps Understand security issues Keyboard shortcuts View page resources

Inspect JavaScript ArrayBuffer with the Memory inspector

Published on

This feature is available from Chrome 91 onwards. You can check your version with chrome://version/.

Use the new Memory inspector to inspect an ArrayBuffer in JavaScript, as well as a WebAssembly.Memory.

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

For Wasm memory inspection, the process is similar to the JavaScript one.

  1. Open this demo page.
  2. In the Sources panel, open memory-write.wasm and set a breakpoint at line 5.
  3. Refresh the page.
  4. In the debugger pane, expand the Scope.
  5. In the Scope section, expand the Module.
  6. Click on the icon next to the $imports.memory property to reveal the Memory inspector. Reveal the Memory inspector

Read this article to learn more on debugging WebAssembly with modern tools.

Last updated: Improve article

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