[whatwg/fetch] Fix memory leak in Fetch with large stream responses (Issue #1870)

2400030206 created an issue (whatwg/fetch#1870)

### What is the issue with the Fetch Standard?

## Memory leak in Fetch with large stream responses

### Description
When processing large responses as ReadableStreams, some implementations fail to properly garbage collect stream resources, leading to memory leaks.

### Steps to Reproduce
1. Fetch a large resource (100MB+) as a stream
2. Cancel the stream before complete consumption
3. Repeat multiple times
4. Observe memory usage growth

### Expected Behavior
Memory should be properly reclaimed when streams are cancelled or consumed.

### Actual Behavior
Memory usage grows with each stream cancellation and is not reclaimed.

### Browser Affected
- Chrome: ✅ No leak detected
- Firefox: ❌ Memory grows with each cancelled stream
- Safari: ⚠️ Minor memory accumulation

### Specification Reference
https://fetch.spec.whatwg.org/#body-mixin

### Severity
Medium - Affects long-running web applications with frequent large data transfers.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/1870
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/fetch/issues/1870@github.com>

Received on Wednesday, 22 October 2025 11:22:43 UTC