Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

237
Views
Clear blob and data urls from browser

we currently have a web app based on NodeJS where data is gathered and its charts are presented as images using the plotlyJS. Below shown is one such code snippet which creates a chart of the data as an image and uses the generated URL to update the respective element (happens once every second).

var d3 = Plotly.d3;
var img_jpg = d3.select("#" + images[id_img]);
var old_url = img_jpg.src;

Plotly.newPlot(plotly_id, plot_data, layout).then(function (gd) {
    Plotly.toImage(gd, { height: 1280, width: 2000 })
        .then(function (url) {
            img_jpg.attr("src", url);
        });
});

This part of the code works as expected but leaves behind a trail of URLs. blob and data URLs to be precise as shown in the screenshot below.

output of the debugger tool showing blob and data URLs generated

These URLs over time floods the browser memory and leads to a crash after a while. stacked URLs after running the application for a few seconds

Reloading the page helps, but not friendly. Tried https://developer.mozilla.org/en-US/docs/Web/API/URL/revokeObjectURL but doest seem to help. Can you please suggest what can be done to clear these URLs from the current instance. Looking forward to suggestions, thank you!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

When calling revokeObjectURL you also need to clear all references to the blobUrl in order for it to be freed.

If an image source is a blobUrl:

image.src = blobUrl;

Clearing it like this works for me:

URL.revokeObjectURL(blobUrl);
image.src = "";
blobUrl = undefined;
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!