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

242
Views
Why Svelte's onDestroy event is not executing URL.revokeObjectURL()?

I've been loading modal with a help of svelte-simple-modal library, and I want to cleanup variable used for loading image that is stored in memory, previously obtained from backend through JSON.

So I have these important things in tag of Modal.svelte (component which loads with modal window):

arrayBufferCover = base64ToArrayBuffer(response[0].details[0].cover);
blob = new Blob([arrayBufferCover], {type: "image/jpeg"});
blobCoverURL = URL.createObjectURL(blob);
onDestroy(() => URL.revokeObjectURL(blobCoverURL));

And this is what I have in HTML section of Modal.svelte:

<img alt="cover" src={blobCoverURL} />

onDestroy event is occuring after modal window is closed, I'm totally sure it does, but when I check in console, I still have multiple objects listed in sources section (everytime I open modal one object is made). Contrary to that, the list of objects I get from chrome://blob-internals/ is periodically getting smaller, which may be meaning cleanup is properly done, just that Sources in Console is not refreshed, but I'm really not sure, especially because IDs I see comparing those two reports are different?

about 4 years ago · Juan Pablo Isaza
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!