Skip to content

[Bug] MemberCount causes severe idle CPU usage and continuous JS heap allocation #4394

Description

@Spencer0187

What happens when the bug or crash occurs?

Enabling the MemberCount plugin causes Discord's renderer to consume substantially more CPU while completely idle.

In the same server and channel, with no user interaction:

  • MemberCount enabled: approximately 3–8% sustained CPU usage, with frequent much larger spikes
  • MemberCount disabled: approximately 0.25–1.5% CPU usage

The DevTools Performance Monitor also shows continuous JS heap growth while MemberCount is enabled. The heap repeatedly grows from roughly 300–500 MB toward 800 MB–1 GB before garbage collection reduces it again. With MemberCount disabled, the heap remains around 200–250 MB and is considerably more stable.

This appears to be continuous allocation churn rather than necessarily a retained memory leak: garbage collection reclaims much of the memory, but the repeated allocation and collection causes significant idle CPU usage.

I isolated MemberCount by testing my enabled plugins in groups of six, then testing the remaining plugins individually. MemberCount alone consistently reproduces the issue.

The problem occurs while idling inside a server. No scrolling, typing, voice activity, or other interaction is required.

I have attached two DevTools Performance Monitor screenshots:

  1. MemberCount enabled
Image
  1. MemberCount disabled
Image

Both were recorded under the same general idle conditions.

What is the expected behaviour?

MemberCount should not cause continuous background CPU usage or sustained heap allocation while Discord is idle.

The plugin should only subscribe to and recompute the data required for the currently visible feature.

In particular:

  • Server tooltip counts should only be queried while the user is hovering over a server icon and the tooltip is mounted.
  • Member-list counts should only update when relevant guild, channel, member-list, or voice-state data actually changes.
  • Flux selectors should ideally return stable primitive values such as the final count, rather than newly allocated objects or arrays that can trigger unnecessary rerenders.

Idle CPU and heap behaviour should remain close to the baseline observed with MemberCount disabled.

How do you recreate this bug or crash?

  1. Install Vencord.
  2. Use Discord Stable.
  3. Enable the MemberCount plugin.
  4. Enable the Member List option. I also had Tool Tip and Voice Activity enabled during testing.
  5. Restart Discord.
  6. Open any server and remain idle in a text channel.
  7. Open DevTools with Ctrl+Shift+I.
  8. Open More tools → Performance monitor.
  9. Enable CPU usage and JS heap size.
  10. Observe CPU usage and heap behaviour for approximately 1–2 minutes.
  11. Disable MemberCount and restart Discord.
  12. Repeat the same test in the same server and channel.

Observed result:

  • With MemberCount enabled, idle CPU remains around 3–8% and the JS heap continuously grows until garbage collection occurs.
  • With MemberCount disabled, idle CPU falls to approximately 0.25–1.5% and heap usage remains much lower and more stable.

Errors

No relevant console errors are produced.

This is a performance issue rather than a crash.

Request Agreement

  • I've searched existing issues and this hasn't been reported before
  • I am using Discord Stable or tried on Stable and this bug happens there as well
  • I installed Vencord via an official method (download from vencord.dev or from source), not via something like AUR or Nix packages
  • This is not a support request
  • I am willing to submit a fix for this myself

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions