Skip to content

high system usage when idle #2132

Closed

Description

@Hona
Image

I dont have the app open, its sitting in the tray idling but still peaks a lot of cpu usage

for context it seems to spike from almost nothing up to 3/4% (which on my machine is almost fully saturating a core) back to nothing forever

Activity

  1. linear commented on Aug 17, 2026

    @linear
  2. richiemcilroy commented on Aug 17, 2026

    @richiemcilroy
    Member

    1.1%? Seems very low. Just quit the app 😁

  3. Hona commented on Aug 19, 2026

    @Hona
    ContributorAuthor

    @richiemcilroy I did a slop

    local investigation rather than relying on the Task Manager snapshot.

    TL;DR: this is not harmless background CPU. Cap 0.5.9 on Windows continuously enumerates cameras while idle and leaks DirectShow resources on each poll. This is the same defect diagnosed and fixed by #2129.

    On my i7-12800H system with 20 logical processors, I measured the hidden/tray process using 0.52 to 1.21 CPU cores, which Task Manager reports as roughly 2.6% to 6.0% total CPU. A 5% reading on this machine is one fully occupied logical core.

    After 4 hours 16 minutes idle, Cap.exe had reached:

    • 3,345 threads
    • 223,563 handles
    • 3.43 GB private memory
    • 838 MB working set

    Cap's own periodic memory log went from virtual_mb=589 after the first minute to virtual_mb=3424 after 4h16m, a sustained increase of about 11 MB/minute. The thread count implies approximately one leaked thread every 4.64 seconds, matching the device-enumeration polling cadence.

    The concrete cause is that Windows VideoInputDevice::new() calls IMoniker::BindToObject during plain camera enumeration. That instantiates each DirectShow capture filter and opens it through the KS driver. Those resources are not reclaimed when the temporary filter is released. Cap runs the enumeration repeatedly (spawn_devices_snapshot_emitter, plus the frontend device poll), so it leaks threads and dozens of handles for the lifetime of the process. My settings have cameraId: null; no selected or active camera is required.

    PR #2129 defers BindToObject until formats or capture are actually requested and reports the same signature: approximately one thread and dozens of handles leaked per enumeration, scaling with the number of camera/virtual-camera devices.

    At 223k handles and 3.3k threads this is also a reliability problem, not only an efficiency issue: it can lead to handle exhaustion and the Windows crashes described in #2115.

    Could this issue be reopened or linked to #2129 until that fix ships? The current stable build, 0.5.9, still contains the leaking path.

  4. Hona commented on Aug 19, 2026

    @Hona
    ContributorAuthor

    forgive the slop details but this should give a lot more context :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions