mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 18:38:55 +00:00
## Summary Removes the `MemoryReportingAllocator` wrapper and simplifies `fetch.zig` to use `bun.default_allocator` directly. The `MemoryReportingAllocator` was wrapping `bun.default_allocator` to track memory usage for reporting to the VM, but this added unnecessary complexity and indirection without meaningful benefit. ## Changes **Deleted:** - `src/allocators/MemoryReportingAllocator.zig` (96 lines) **Modified `src/bun.js/webcore/fetch.zig`:** - Removed `memory_reporter: *bun.MemoryReportingAllocator` field from `FetchTasklet` struct - Removed `memory_reporter: *bun.MemoryReportingAllocator` field from `FetchOptions` struct - Replaced all `this.memory_reporter.allocator()` calls with `bun.default_allocator` - Removed all `this.memory_reporter.discard()` calls (no longer needed) - Simplified `fetch()` function by removing memory reporter allocation/wrapping/cleanup code - Updated `deinit()` and `clearData()` to use `bun.default_allocator` directly **Cleanup:** - Removed `MemoryReportingAllocator` export from `src/allocators.zig` - Removed `MemoryReportingAllocator` export from `src/bun.zig` - Removed `bun.MemoryReportingAllocator.isInstance()` check from `src/safety/alloc.zig` ## Testing - ✅ Builds successfully with `bun bd` - All fetch operations now use `bun.default_allocator` directly ## Impact - **Net -116 lines** of code - Eliminates allocator wrapper overhead in fetch operations - Simplifies memory management code - No functional changes to fetch behavior 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> Co-authored-by: Claude Bot <claude-bot@bun.sh> Co-authored-by: Claude <noreply@anthropic.com>