Open Bug 1504623 Opened 7 years ago Updated 9 months ago

Callbacks cause excessive webextension process memory growth

Categories

(Core :: JavaScript: GC, defect, P3)

65 Branch
defect

Tracking

()

People

(Reporter: ke5trel, Unassigned, NeedInfo)

References

(Blocks 1 open bug)

Details

(Keywords: memory-footprint, Whiteboard: [MemShrink:P2])

Attachments

(1 file)

Test case: Play three twitch.tv streams on Nightly 65 with a new profile. No extensions: WE memory stable at 108MB. HTTPS Everywhere: WE memory grows at a steady 7.5MB/min, peaking at 380MB before collection. uBlock Origin: WE memory grows at a steady 3MB/min, peaking at 552MB before collection. With multiple extensions installed the growth is faster and the peaks are higher. Doubling the number of twitch streams doubles the rate of memory growth. The memory delta is: 51% dom/structured-clone-holder 30% window-objects/<extension>/js-zone/strings 15% js-non-window 4% heap-unclassified Editing HTTPS Everywhere to remove all webRequest and cookies.onChanged listeners avoids the memory growth. Registering them with empty callback functions still causes the same memory growth.
This sounds familiar. Jon, can you take a look? Maybe callbacks are somehow only being cleared with a shrinking GC?
Component: General → JavaScript: GC
Product: WebExtensions → Core
Whiteboard: [MemShrink] → [MemShrink:P2]
Flags: needinfo?(jcoppeard)
Yeah, I'm pretty sure this is a GC issue. Every time someone reports an issue like this, the memory goes away after running minimize memory in about:memory. I might be able to figure out more if I can reproduce locally...
Flags: needinfo?(jcoppeard)
Priority: -- → P3
Blocks: 1533449
No longer blocks: GCScheduling

There's been a bunch of GC scheduling improvements since this was filed. Kestrel, can you check whether this still happens on nightly?

Flags: needinfo?(ke5trel)
Severity: normal → S3

There seems to be a more severe instance of this in https://github.com/uBlockOrigin/uBlock-issues/issues/3468#issuecomment-2504720071 (I have not tested myself).

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: