Commit ae42338
committed
Fixing memory leak when removing tracks / streams
The _senderMap keeps references to no more used MediaStream / MediaTracks.
In an application where many tracks will be added/removed from a remote peer,
the "dead" tracks keep accumulating in _senderMap.
To avoid this, we turn _senderMap and its inner map into WeakMap.
This way, if the track is never used anymore, it will be freed from memory.1 parent 08eab06 commit ae42338
1 file changed
+3
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
| 75 | + | |
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| |||
0 commit comments