Improve Garbage Collection of Webapp
I've noticed that Twitch seems to have a major garbage collection problem. I use Firefox (97.0.1 currently).
Granted, I currently have 5 streams open with 4 of them tiled on my TV, however, the memory usage can be seen in excess of 10 GB.
When I do manual garbage collection via about:memory?verbose
, it can drop back down to about 2-3 GB total usage on the main process with 5 streams open.
This sort of memory bloat only happens when I use Twitch. Firefox reports that the memory is under control (less than 1 GB total) in about:performance
, but it seems to only happen when Twitch is open.
Edit: To add to this, since I think it's related:
I am currently watching ironmouse for example. For some reason the entire UI seems to choke, as well as the video will stutter. It is completely random. It seems to happen on her stream most often and not really anyone else's that much.

-
DarkSwordsmanTV commented
Just wanted to confirm once more, since I got more concrete evidence of it.
It seems that when chat is mega spammed with a ton of emotes very fast, the whole entire UI starts to lag. Doesn't really matter what streamer it is, and even with all my twitch-related extensions turned off.
-
DarkSwordsmanTV commented
So I spent some more time researching, and on top of the garbage collection, I think I've realized that this coincides with a problem with Twitch chat.
Watching ironmouse, if her chat starts to get spammed with emotes, it seems that the whole entire UI will start to lag. This also causes the video player to stutter and buffer.
Then as a result, the video player will try to catch up by adjusting the video speed. However, the video speed, instead of being a smooth bezier curve or something, ends up being random. It sounds like it's speeding up from 1.0x to 1.05 or 1.10x speed every couple dozen milliseconds. It causes this pitch-shifted mess to happen and the audio's pitch literally wobbles.
So this is obviously, in my opinion, quite a few different issues. I mainly just wanted to document them in an official place.
I currently have 5 video players up and have for a couple weeks. It always *only* happens on ironmouses stream when her chat starts to get spammed.