← Back to Runtime domain

Runtime.getHeapUsage

Returns the JavaScript heap usage. It is the total usage of the corresponding isolate not scoped to a particular Runtime.

Domain: Runtime experimental

Returns

NameTypeDescription
usedSizenumberUsed JavaScript heap size in bytes.
totalSizenumberAllocated JavaScript heap size in bytes.
embedderHeapUsedSizenumberUsed size in bytes in the embedder's garbage-collected heap.
backingStorageSizenumberSize in bytes of backing storage for array buffers and external strings.

Example Request

{
  "id": 1,
  "method": "Runtime.getHeapUsage"
}

Example Response

{
  "id": 1,
  "result": {
    "usedSize": 1.0,
    "totalSize": 1.0,
    "embedderHeapUsedSize": 1.0,
    "backingStorageSize": 1.0
  }
}

Usage in Node.js

const result = await send('Runtime.getHeapUsage');
console.log(result);
// {"usedSize": 1.0, "totalSize": 1.0, "embedderHeapUsedSize": 1.0, "backingStorageSize": 1.0}