max-mapper / max-mapper/multiplex

Memory leak when multiple streams created at the same time

Open
#31 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
143
Forks
25
PR merge metrics
No merged PRs in 30d

Description

Hi all,

When creating multiple streams at once the _.local and _remote lists can continuously grow in size due to the null entries never getting cleared up. This gradually causes a memory leak.

Sample gist here

https://gist.github.com/Alan01252/efa75907063ff5c5b63df26098f1a06d

I've naively fixed the issue here, it's not perfect ( I'm sure you guys will have much better ideas on how to do this ) but it does seem to work.

https://github.com/Alan01252/multiplex/tree/fix/memoryLeak

If you have a few minutes I'd be very appreciative of your thoughts / solutions :)

Thank you

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the stream-creation and cleanup paths that manage the _.local and _remote lists, then compare the behavior with the linked gist and proposed fix branch. Done means repeated concurrent stream creation no longer leaves null entries accumulating and causing memory growth.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.