Skip to content

BUG: Remote image cache grows unbounded (memory leak) #516

@andrinoff

Description

@andrinoff

Describe the bug

In view/html.go, remote images fetched for HTML email rendering are cached in a sync.Map (remoteImageCache) that never expires or evicts entries. Each unique remote image URL adds a base64-encoded PNG to the cache permanently.

For users who read many HTML emails with unique remote images (newsletters, marketing emails), memory usage grows unbounded over the session lifetime.

To reproduce

  1. Read many HTML emails with remote images (newsletters, etc.)
  2. Monitor memory usage of the matcha process over time
  3. Memory grows with each new unique image URL and never decreases

Expected behavior

The remote image cache should have:

  • A maximum entry count or total size limit
  • LRU eviction when the limit is reached
  • Or time-based expiration (e.g. clear after 30 minutes)

OS

All platforms

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions