Memory leak in extension: brave?

Description of the issue: So I was using brave browser for past 8 hours then I saw that my memory usage went up since the time I started. I opened the browser task manager and saw that ‘extension: brave’ is consuming a large chunk of ram.

Steps to Reproduce: 1. open brave with like 15ish tabs in your social media and other news websites.
2. browse for 8+ hours
3. notice how extension: brave is consuming 1,000,000K+ memory

**Actual Result : **

Expected result: The memory usage of extension:brave stays similar to when first started.

Reproduces how often: I have experienced this for past week every single day since I installed brave.

**Operating System and Brave Version:**Version 1.41.96 Chromium: 103.0.5060.114 (Official Build) (64-bit)| Operating system: Linux mint 20.3 (system info: https://termbin.com/v7ma )

Additional Information: I am using dark reader, reddit enhancement suit, return youtube dislike, h264ify , sponsorblock for youtube

It’ll be the extension leaking. Try disabling some of the extensions, and retest. Then based on the results, either keep them disabled or disable more extensions.

This is interesting.

Extension:Brave always was Brave Shields Button/Panel UI.
There was a way to disable it on start by using –disable-brave-extension to start Brave, the Shield’s icon would disappear and you would get no panel or Extension:Brave process for anything.
The thing about Brave’s adblocker is that it is native and always works as long as the settings say so, so even if there was no UI or Brave shields icon, the work of the adblocker never stopped, that’s why I always used that flag in the past, because Extension:Brave was a waste of resources since I never even opened Shields panel to see what was being blocked or controlled shields through it because it messes with the preferences file and I hated it.

But with the release of Shields v2 Panel update, seems like Extension:Brave shouldn’t even be a thing anymore, it should not even be there at all. Because when you use --disable-brave-extension the extension:brave process disappears but the Shields v2 icon/UI/panel is there and it works just fine.

I remember that being a thing like if I enabled ShieldsV2 flag in Nightly when it was being developed you would get to see two Shield icons on the address bar. And if you started Brave disabling the Brave Extension and then you would only see the new one, and the v1 would be disabled with the extension:brave process.

So, it seems like you (nobody) shouldn’t even be getting this, because shields v1 is not a thing anymore so the Extension:Brave shouldn’t have any presence anymore in Brave Browser. It is a waste of memory and maybe an extension caused the issue or a page or whatever but I really don’t see why extension:brave process is still there wasting resources, for example, when I launched Brave without disabling that extension:brave used 23,000K for normal windows and 18,000K for inPrivate windows, so that was 41,000K memory wasted unnecessarily and since Shields v1 is not a thing anymore, why is it still there?

Chromium extensions work like if an extension is allowed in inPrivate mode then it will be spawned twice, and if you open a new profile in Brave, Shields will be loaded one more time, so if I opened 10 profiles, there would be 230,000K of useless and wasted memory because of extension:brave which again, shouldn’t be present anymore because Shields v1 is not even a thing anymore, it can’t even be enabled by flags like in the past.

So test Brave with --disable-brave-extension and see how it goes, I mean, you are disabling it so I don’t think you will have a problem anymore.

1 Like

I have always wondered what “Extension: Brave” is, but now I know. @emi Thanks for the great explanation! I can imagine that those detailed lists of every resource that is blocked can be endless after a while… I’ll give this a shot and see how it works. :+1:t2:

But I thought extension : brave was adblocker is that not the case?

ok I will try that thanks!

There are few references about it, some files in the source code mention this flag but not what they do.
The only one that says something about it is in the Brave’s github wiki: Custom Brave Switches.

npm start --disable_brave_extension: Disable loading Brave extension on startup (note: this only disable the extension control view, not Shields)

Anyway, I found out what you will disable without it. Using --show-component-extension-options which shows all the native extensions brave has in the extensions page, I saw this extension that disappeared when I ran the --disable-brave-extension, one with Brave logo that is called

Brave
1.0.0
MSG_appName
ID: mnojpmjdmbbfmejpflffifhffcmidifd

Searched the ID in the Secured Preferences file and it mentions “web_accessible_resources”: [“elementPicker.html”, “elementPicker.js”]

So I guess I got my answer why Brave still has this extension:brave running, it is because of the adblocker’s element picker.

I never use it, so I don’t care about it, I just use the DevTools if I want to block an element or/and I use uBlock origin’s element picker since it has a preview mode and gives more info in case I need to make sure my rule works as expected.

So I guess you have to be aware you will be losing that brave adblocker’s element picker if you run Brave like that.
It still doesn’t make sense why it would take so much memory on your side, since element picker JS and html only work when you use it, so some background js or something is causing the issue, pretty weird.

yeah it is pretty weird I am willing to sacrifice that feature as long as it doesn’t effect the functionality of actual adblocker and other fingerprinting prevention.