Skip to content

memory leak: screenshot cache never cleared after popup closes #9

@codehakase

Description

@codehakase

Summary

The SCREENSHOT_CACHE HashMap in src-tauri/src/lib.rs stores every captured screenshot in memory indefinitely. Images are only removed when the user explicitly clicks the Delete button. All other workflows—auto-dismiss, save, copy, edit—leave the image data in the cache.
The cache has three insertion points (capture_screenshot_internal, capture_screenshot_internal_with_auto_copy, capture_full_screen) but only one removal path (delete_from_memory command), which is only triggered by the delete button handler in useScreenshot.ts.

Impact

During long-running sessions, memory usage grows with every screenshot. Based on recent logs, individual images range from 38KB to 1.3MB. There is no automatic eviction—the cache only clears when the process exits.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions