Skip to content

Performance: Unbounded queue growth can lead to memory issues #46

@m96-chan

Description

@m96-chan

Summary

The async queue in \ has no maximum size, which can lead to unbounded memory growth if consumer is slower than producer.

Location

Problem


The queue is created without a maxsize, meaning it can grow indefinitely if:

  • The async consumer is slow to process data
  • User code doesn't call \ or iterate fast enough

Impact

  • Memory can grow unboundedly in long-running capture sessions
  • No backpressure mechanism to signal producer to slow down
  • Potential OOM errors in constrained environments

Comparison with other backends

Linux backend correctly sets a bounded queue:
\

Suggested Fix

Add a reasonable maxsize to the queue:

\

Labels

performance, bug

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