Closed Bug 1725453 Opened 4 years ago Closed 4 years ago

Memory Leak with Blob+Uint8Array

Categories

(Core :: DOM: File, defect, P3)

Firefox 91
defect

Tracking

()

RESOLVED DUPLICATE of bug 1702447

People

(Reporter: cp.piber, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0

Steps to reproduce:

Setting data in a Unit8Array that is bound to a Blob causes memory to explode.

Code:

(() => {
  const rand = (len) => {
    const a = [];
    for (let i = 0; i < len; i++)
      a.push(Math.random() + 256);
    return new Uint8Array(a);
  };

  const l = 10000;
  const n = 1000;
  const total = l * n;
  const parts = new Uint8Array(total);
  let position = 0;
  const blob = new Blob(parts);

  for (let i = 0; i < n; i++) {
    const value = rand(l);
    parts.set(value, position);
    position += value.length;
  }

  return parts;
})();

I believe this is a regression, I don't think it happened in 90.0.2.

Possibly related to https://bugzilla.mozilla.org/show_bug.cgi?id=939439

Actual results:

Memory consumption of "Web Content" process exploded into GBs. Without the blob, it only rises a little.

Expected results:

Same behavior as without a blob.

The Bugbug bot thinks this bug should belong to the 'Core::DOM: File' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

Component: Untriaged → DOM: File
Product: Firefox → Core
Severity: -- → S2
Priority: -- → P3
Severity: S2 → S3
Status: UNCONFIRMED → RESOLVED
Closed: 4 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.