Skip to content

[BUG] Memory leak in GM_xmlhttpRequest responseType="stream" due to unreleased Blob URLs #2653

@alpgul

Description

@alpgul

Issue Description

Using responseType="stream" in GM_xmlhttpRequest causes a significant memory leak. Data is transmitted via Blob URLs that remain open indefinitely, even after being written to the stream.

Details

  • Persistent Blobs: Blobs created for data transfer are never closed or released.
  • Memory Leak: Since these Blobs are never revoked, they cannot be reclaimed by the Garbage Collector. Memory usage grows linearly with the stream size, leading to potential crashes during large transfers.

Expected Behavior

The lifecycle of Blobs must be managed to free system resources:

  • Cleanup: Each Blob URL should be explicitly released (e.g., using URL.revokeObjectURL) immediately after it has been processed or written to the stream.
  • Memory Management: Ensure that data chunks do not persist in memory once they are no longer needed.

Impact

This issue makes the stream feature unstable for large datasets or long-running streams due to uncontrolled memory growth.

Environment

  • OS: Linux
  • Browser: Chrome v143
  • Tampermonkey Version: v5.4.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions