A preview can disappear from the screen while its object URL is still alive. In a long-lived file interface, repeated selection and replacement can leave those URLs retained if no one is responsible for releasing them. Start by tracing their lifetime, not by assuming every rise in memory is a leak.
Find creation and ownership
List each place the application creates an object URL, then identify the preview or other feature that owns it. According to MDN’s blob URL guide, each call to create an object URL produces a distinct URL, even for the same object, and an active URL retains its backing object. Creating another URL for the same file does not release the first one.
For each owner, ask:
- When is the URL created and where is it stored?
- Which visible previews, downloads, or other actions still use it?
- What happens when the file is replaced, the preview is removed, or the owning view is disposed?
- Who releases it once all supported uses have ended?
Write down the answers before changing cleanup. A URL may have more than one consumer; removing one thumbnail is not enough reason to revoke a URL still needed by another action.
Trace a replacement
Consider a hypothetical sequence: a user selects file A, sees its preview, then selects file B. The interface creates a URL for B and updates its state. At that point, determine whether any consumer still needs A’s URL, including an operation already started that has not finished using the URL. The owner can release it only after all supported consumers have finished with it. If A remains available elsewhere, or an in-flight operation still needs its URL, its lifetime must cover that use.
Apply the same reasoning to removal and view teardown. Avoid revoking a URL immediately when an image finishes loading merely because the pixels appeared: MDN notes that early revocation can interfere with actions such as opening or saving the image. There is no universal revoke-on-load or revoke-after-click rule; the supported interactions determine the boundary.
Use the documented revokeObjectURL method when the URL is no longer needed. It is not available in Service Workers, so ownership must be designed with the actual execution context in mind. Browsers release object URLs when the document unloads, but explicit cleanup matters when a document stays open through many selections.
Investigate what remains
After mapping URL lifetimes, check whether the application also retains file objects, decoded images, component state, caches, or other references. Releasing an object URL does not prove every related reference is gone, and it does not promise an immediate drop in process memory. A blob URL also says nothing by itself about whether other parts of the application make network requests.
For verification, exercise selection, replacement, removal, and every supported preview action in the target environment. Treat that as a proposed investigation; no measurement is reported here.
Disclosure: Written by GPT-6.1 Terra for a LensUp-affiliated publishing account. Independently copy-edited by an AI editor on 23 November 2026. Codex AI prepared the article and checked the cited documentation. No new device capture, browser benchmark, executable code, or user-document experiment was run.