Skip to content

Fixable memory leak in Chromium based browsers #164

@zsilbi

Description

@zsilbi

Hi!

I found a nice memory leak issue in Chromium based browsers due to a V8 engine string slicing problem.
More about it here: https://bugs.chromium.org/p/v8/issues/detail?id=2869

This causes a longer DVR live stream (tested with 10 hours long) to crash in 30-40 minutes in video.js 7+ due to extreme memory consuption.

235371930-1a7810ff-a42c-4610-aa49-d4a21186c960

235372738-9bb0a8fc-8502-4376-aae8-2075b417d5f6

A possible solution is just a small hack that's required for every parsed string.

For example:

if (line[0] !== "#") {
  this.trigger("data", {
    type: "uri",
    uri: (" " + line).substring(1), // <-------
  });
  return;
}
match = /^#EXT-X-PROGRAM-DATE-TIME:(.*)$/.exec(newLine);

if (match) {
  event = {
    type: 'tag',
    tagType: 'program-date-time'
  };

  if (match[1]) {
    event.dateTimeString = (" " + match[1]).substring(1);  // <-------
    event.dateTimeObject = new Date(match[1]);
  }

  this.trigger('data', event);
  return;
}

These modifications reduced the players memory consuption from 2 GB to 30 MB.

Best regards,
zsilbi

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions