brave / brave-browser

Brave browser for Android, iOS, Linux, macOS, Windows.
https://brave.com
Mozilla Public License 2.0
16.74k stars 2.16k forks source link

[bug] Memory leak when chat is active on YouTube live stream #37900

Open anphonic opened 2 weeks ago

anphonic commented 2 weeks ago

Description

There seems to be a memory leak when chat is active on YouTube live stream. When chat is open on a popular stream (i.e. Ryan Hall Y'all) the memory usage for that tab climbs with occasional very slight drops but generally increasing to 1GB+ in under 3 minutes . When chat is closed, the memory usage climb stops and might vary slightly up/down but the memory isn't released unless the tab is closed/reopened or the task is ended stream reloaded.

Steps to Reproduce

  1. Open a YouTube live stream with high chat volume,
  2. Open Brave Task Manager OR desktop task manager
  3. With chat open and very active, watch the memory usage.
  4. Memory usage will start to increase.
  5. Close the YouTube chat
  6. Memory usage will stop consistently rising
  7. End task/reload tab - Otherwise wait until the available memory is exceeded and tab crashes.
  8. Reload tab
  9. Immediately close YouTube Chat.
  10. Observe how the memory level doesn't consistently increase

Actual result:

This screenshot it the same stream, both started within 5 seconds of each other and have run approximately 4 minutes. Left has had chat active the entire time while the right had chat disabled as soon as it was possible (appx 3 seconds after initial reload) 2024-04-26 18_10_25-(3) 🔴LIVE - Severe Weather Coverage With Storm Chasers On The Ground - Live Wea

Expected result:

Memory usage doesn't continually rise when chat is very active and open

Reproduces how often:

This started with the most recent update 1.65.123 (Apr 26, 2024) Upgraded Chromium to 124.0.6367.91. (#37864)

Brave version (brave://version info)

Brave 1.65.123 Chromium: 124.0.6367.91 (Official Build) (64-bit)
Revision dd88871b12997b018e3acb2f589713a3ea10338b
OS Windows 11 Version 23H2 (Build 22631.3447)

Version/Channel Information:

Other Additional Information:

Miscellaneous Information:

Extensions: (DISABLED) Adobe Acrobat: PDF edit, convert, sign tools

SnowySailor commented 5 days ago

Experiencing the same issue on the same exact youtube stream. Was searching google for this issue after getting an OOM and came across this. The chat activity is quite high (often >5 msg/sec) and the tab memory creeps up and up by around 15-30MB per minute, although I suspect that sometimes it's significantly higher since I have 32GB in my system and my total usage is <15GB outside of Brave. The system memory (according to the Windows task manager) in use seems to be increasing at a much higher rate. Edit: memory jumped from ~900MB to 1.4GB within about 2 mins during a recent chat activity spike.

I am running the 1.65.126 with Chromium 124.0.6367.118 in a private browser with no extensions active besides Yomitan, which I've never had a memory issue with before so I doubt it is the cause.