erosman / support

Support Location for all my extensions
Mozilla Public License 2.0
175 stars 12 forks source link

FoxyTab eating all memory when closing tabs with "Host -> Host close" (5000 tabs) #626

Open naodesu opened 9 months ago

naodesu commented 9 months ago

When I use command "Host -> Host close", firefox.exe quickly start eating all of my 32Gb RAM. Tested on clean FF profile with only FoxyTab extension installed, all setting are default. I only imported my sessionstore.jsonlz4 file (with 5000 tabs) from main profile, so I can reproduce the bug.

Tested on WIndows 11 with FF versions: 123.0b8 (64-bit) 122.0.1 (64-bit)

Also, when option "Open previous windows and tabs" is disabled (it's a default in FF) and I use command: history->restore previous session FF also starts eating RAM quickly. This is also reproduced ONLY if FoxyTab is enabled.

erosman commented 9 months ago

Host close

The process involves...

I suspect the process of removing many tabs by Firefox could be the reason.

Please test the following:

Open previous windows and tabs

Opening a new tab triggers multiple processes, many of which are asynchronous.

Opening 5000 tab triggers 5000 sets of these process which does use CPU/RAM. Try disabling them and test again.

WannaKnot commented 6 months ago

I'm getting similar for: tab>right click>FoxyTab>host>move host to this window,

~50 GB additional RAM increase over ~5-10 minutes, then dropping back to normal RAM usage. To move ~400 tabs to specific window. image

If it is done with few tabs then <40, it will be a slight increase and a minute or two.

erosman commented 6 months ago

I'm getting similar for: tab>right click>FoxyTab>host>move host to this window,

In this case, the move is done with a single request.

Therefore, it is Firefox that is using the CPU/RAM to move the tabs.

BTW, have you tested it with all extensions disabled except FoxyTab?

WannaKnot commented 6 months ago

Retried with only FoxyTabs enabled and was several times faster, RAM spike went up faster and down faster.

The first time the tabs were moved...

Subsequent tries were several times longer delayed, UI doesn't show updates and but was still able to type into this text box, it wasn't until RAM spike returned to normal that the UI started updating again.

Tried with several different hosts, aside from that very first one, all be very delayed.

Tried with and without internet connectivity.

The RAM spike doesn't seem to go down until all tabs have their Favicons and Titles populated, saw this via the "List all tabs" drop down, kinda hard to check since the whole UI is unresponsive except for that drop down Favicons and Titles updating, can't interact though.

erosman commented 6 months ago

In Firefox (or any other browser), the process of moving a tab from one window into another window involves:

Process is repeated for each tab that is moved. The reason RAM increases is that Firefox is opening 400 new tabs together.

Firefox has a native "move tab to a new window" function as well.

It should be a bit faster since it is a native function (no communication step between the extension and the browser).