CatBlock / catblock

CatBlock - An ad-blocking extension (with an ability to replace ads by pictures) for all major desktop browsers!
https://getcatblock.com
GNU General Public License v3.0
95 stars 44 forks source link

Potential Memory Leak Problem? #173

Closed Damariobros closed 4 years ago

Damariobros commented 4 years ago

English only!

Please answer the following questions so that we can process your bug report, otherwise, we may have to ignore it.

Can you provide detailed steps on how to reproduce the problem?

  1. Keep running Google Chrome for a while and use it as normal.
  2. Don't close Chrome, though closing individual tabs is fine.
  3. After a long time (usually after a few hours, but sometimes after a few days), go to each tab and take note of the number of blocked ads "on this page".
  4. Add up all of the individual tabs' number of blocked ads.

What should happen when you do the above steps
You should see that all of the individual tabs' blocked ads should add up to the number of blocked ads "in total".

What actually happened?
There is a substantial difference in the combined number of blocked ads per tab compared to the total number of blocked ads, often in the thousands.

Do you have any other comments? If you can, can you please attach a screenshot of the bug?
The Following is a List of Screenshots that show the amount of ads blocked in each tab (these are links to Imgur): 1) First Tab 2) Second Tab 3) Third Tab 4) Fourth Tab 5) Fifth Tab 6) Sixth Tab Notice how there are three ads combined from the individual tabs (only one of the websites I am currently on have any ads), yet CatBlock claims that there are a total of 1,400+ ads being blocked (and how that number keeps increasing)? I believe that to be a sign of memory leakage.

--- The questions below are optional but VERY helpful. ---

If unchecking all filter lists fixes the problem, which one filterlist must you check to cause the problem again after another restart?

Technical Chrome users: Go to chrome://extensions ->Developer Mode -> Inspect views: background page -> Console. Paste the contents here:

itskdog commented 4 years ago

Hi there,

The "total" number reported is the number of ads that have been blocked since you installed CatBlock, not the number of ads across all currently opened tabs.

When your browser tells CatBlock that it's blocked something (specifically a URL-based block, that stops the ad from being downloaded, not an HTML-based hide which isn't counted for performance reasons, but are the only ones that CatBlock can do image replacement on), our code increases the both the page's counter by 1, but also the locally-stored total count is increased by 1 and saved back to CatBlock's settings storage.

AdBlock, on which our code is based on, has this same feature, we have not modified it, and it works exactly the same.

Hope this explains the meaning of this in more detail, and reassures you that all is working as it should.

Damariobros commented 4 years ago

Thank you for clearing that up! Though, I'm a bit confused and curious -- what ads are you talking about that need to be "downloaded"? It seems like on sites like Google Slides, there are TONS of them, and on other sites, there aren't very many of them (though there are HTML blocks). I'm genuinely curious as to what ads are downloaded and how they work. Are they web beacons? Cookies? Are they the things that track you across sites?

itskdog commented 4 years ago

If you have additional lists like EasyPrivacy or Antisocial, those are added to the list of URLs that will be blocked.

Everything online has to be downloaded to your PC, even if it just stays in RAM and isn't written to disk, before you can view it.

In the context of what I said above, I was meaning the act of downloading it over the internet in order to load the web page, not downloading and saving it to your hard drive like you would an app update.

Damariobros commented 4 years ago

Ah, okay. That makes sense. Although, why does there need to be so many HTML blocks? Sometimes I load a page and there are hundreds of cats that are loaded in addition to the rest of the page (e.g. when I do a Google Search for the term "window"). Is there a way to put a cap on how many HTML blocks there can be before it just starts blocking ads from even being downloaded?

itskdog commented 4 years ago
Whether a rule is hide or block is part of the filter lists that actually tell the ad blockers what to do (AdBlock, ABP and uBlock all use the same lists by default). They prefer to block over simply hiding the ad to save on bandwidth and reduce tracking, amongst other benefits, but hiding is a last-resort option. I don’t know CatBlock’s code well enough myself to actually know how it works (it was written back in 2012 for an April Fools’ joke, originally), but I think there’s something, somewhere, whether it’s in a filter list or part of the code that can trigger multiple image replacements near each other. If you’re interested, feel free to dive in to the code and submit a pull request if you’re able to work it out (it’s been a long time since anyone has looked at the code too deeply, I think)  Feel free to hop on our Discord server if you want to chat more generally about CatBlock. From: DamariobrosSent: 28 September 2020 8:19 PMTo: CatBlock/catblockCc: Kieran; State changeSubject: Re: [CatBlock/catblock] Potential Memory Leak Problem? (#173) Ah, okay. That makes sense. Although, why does there need to be so many HTML blocks? Sometimes I load a page and there are hundreds of cats that are loaded in addition to the rest of the page (e.g. when I do a Google Search for the term "window"). Is there a way to put a cap on how many HTML blocks there can be before it just starts blocking ads from even being downloaded?—You are receiving this because you modified the open/close state.Reply to this email directly, view it on GitHub, or unsubscribe.