The My Opera forums have been replaced with forums.opera.com. Please head over there to discuss Opera's products and features
See the new ForumsYou need to be logged in to post in the forums. If you do not have an account, please sign up first.
Extensions eat a lot of memory! Starting the same session with 18 extensions needs 1.5GB more!
Hi,For a long time now (though can't tell how long), I've noticed that my Opera configuration was using more and more memory. Didn't take time to investigate so far, though I noticed however that the same session opened with Opera Next was far less greedy.
Based on this finding, I knew that this was linked to my Opera profile, ie. my Opera configuration. I intuitively suspected that this could be due to one of my user javascripts or of my enabled extensions.
As having commonly numerous tabs open, I tried some testing with 116 tabs open (OK a bit exaggerated but this helps to highlight my issue). So, here is the "Private bytes" value shown by Process Hacker (a Process Explorer contender) with different configurations regarding userjs & extensions:
- the scenario is always the same: starting Opera with an autosave.win including 116 tabs, waiting for all tabs to be loaded, then waiting that the value for "Private bytes" gets more or less constant, and writing down the value, and finally closing Opera
- with all extensions disabled, and user javascript folder missing (my way to fully disable it): about 800 MB
- with all extensions disabled, and user javascript folder restored: about 800 MB
- enabling a single extension, supposed to not interfere with each page: "Todoist Button" (note that the buttopn was never clicked): 820 MB, so adding a single button leads to 20 MB extra...
- enabling a second button-base extension "Diigo" (never clicked): 867 MB, and 47 MB more...
- now, re-enabling my 16 other extensions (so a total of 18 extensions): a whopping 2.3 GB, the needed memory was almost multiplied by 3, for the exact same amount of tabs and the very same page contents!
So, is there something rotten in the state of Opera Extension?
Does anyone else has a similar experience?
Does somebody from Opera can tell us how memory is allocated/managed with extensions with regard to each tab opened?
For the time being, my conclusion is: when there is both a "raw" userjs and an extension implementing the same feature, favor the userjs. And don't enable extensions that you don't really need.
Originally posted by TerDale:
when there is both a "raw" userjs and an extension implementing the same feature, favor the userjs.
No, I prefer an extension instead. And extensions like ad-blockers and Ghostery need to work on each page so 3x memory usage is not something to be very surprised about.
If you need any help from me with regards to Opera, please make a comment on any of my blog posts.
Support Opera wishes
Originally posted by Swapnil99pro:
No, I prefer an extension instead. And extensions like ad-blockers and Ghostery need to work on each page so 3x memory usage is not something to be very surprised about.
Huh!? And how do you justify such memory needs for extensions like Diigo or Todoist buttons, that supposedly have no interaction with the current page?
Moreover, you should know that whatever the way a feature is implemented (ie. via a userjs installed in your userjs-designated folder or via an extension (most (all?) of which are javascript-based anyway)), the corresponding code is loaded with each and every page (except explicitly excluded ones). However, my tests show that with "raw" javascripts (raw is meant for not being embedded in an extension) the memory needs are far, far less. So, FMPOV this shows that there should be something wrong with the extension framework.
The best to demonstrate it would be to have the same script in its raw form along with embedded in an .oex, and compare the memory consumption depending on which one is loaded. I plan to do it, I just have to investigate if I can do it easily from one of the extension I use (knowing that .oex are merely archives from which the actual code file can be extracted, though what I still have to determine is if the javascript file can be directly copied to the userjs folder, or if it needs some adaptations).
Originally posted by TerDale:
And how do you justify such memory needs for extensions like Diigo or Todoist buttons, that supposedly have no interaction with the current page?
There are some exceptions, but anyway having 18 extensions is tooo much. 18 extensions can render Firefox unstable, kill the light and fast feel (remember it only feels fast, in reality it isn't) of Chrome and as you say make Opera a memory hogger.
Originally posted by TerDale:
However, my tests show that with "raw" javascripts (raw is meant for not being embedded in an extension) the memory needs are far, far less.
A fair test would be using 18 UserJS and 18 extensions which both do the same task, neither more nor any less tasks. It is impossible to find a directly corresponding UserJS to 18 Opera extensions, so your test is not a real benchmark. It just concludes that extensions eat some more memory than UserJSes. However the tests cannot be used for concluding that extensions use 3x memory of that of UserJSes.
Originally posted by TerDale:
So, FMPOV this shows that there should be something wrong with the extension framework.
I don't think so, and memory usage by an extension also depends on how well the extension is coded.
If you need any help from me with regards to Opera, please make a comment on any of my blog posts.
Support Opera wishes
- big session with no userjs and no extensions: ~840 MB
- restarted once enabled Snaplink extension (BTW based on Ayush's userjs): ~905 MB
- restarted once disabled Snaplink extension, but after extracting its javascript file from the oex and copying it in my user javascript folder (thus the very same script, not the original from Ayush): ~860 MB.
So, exactly the same script, with the same set of pages, the only difference is that it is embedded or not in an extension. Embbedded => +45 MB. So, extrapolating with ~10 extensions, you end up with 0.5 GB gone just because your js are embedded in extensions.
Originally posted by TerDale:
+1when there is both a "raw" userjs and an extension implementing the same feature, favor the userjs.
I use multiple Opera profiles/ installations alongside. With UserJS, all I need is to put them in a common UserJS folder just once to be used by the 3+ Opera profiles. With extensions, I'd have to install it to each profile.
At least, unlike FireFox, Opera is quite usable without any extensions, for me at least.
Opera versions: 12.02, 12.14 & 12.16