Tab-session-manager: Out of memory/huge memory usage when restoring session

Created on 7 May 2018  ยท  9Comments  ยท  Source: sienori/Tab-Session-Manager

TSM 3.1.1
Firefox 59.0.2
Linux Mint
Session with18 windows and 831 tabs (file: 20MB) (less are problematic too)

Often when i try restore last session, ff create all tabs and get very slow (it's unable to load active tabs). One thread consume 100% cpu and memory usage slowly grow reaching huge value above 30GB causing OOM or manual kill when issue is recognized. Sometimes restoring is successful - fast, without 100% and no memory consume or with very small memory overhead.

Last time i got 16GB memory peak with successful restore, then memory usage drop to reasonable 1GB. This allow me to run about:memory between successful restoring and memory drop.

Report show that 10GB is allocated by TSM.

11,436.85 MB (100.0%) -- explicit
โ”œโ”€โ”€10,493.84 MB (91.75%) -- add-ons
โ”‚ โ”œโ”€โ”€10,487.74 MB (91.70%) -- Tab-Session-Manager@sienori/window-objects/top(moz-extension://6eb04b01-249e-4bcb-bd6f-9ce63038df7f/_generated_background_page.html, id=13)
โ”‚ โ”‚ โ”œโ”€โ”€โ”€6,101.16 MB (53.35%) -- active/window(moz-extension://6eb04b01-249e-4bcb-bd6f-9ce63038df7f/_generated_background_page.html)
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€6,100.94 MB (53.34%) -- js-compartment(moz-extension://6eb04b01-249e-4bcb-bd6f-9ce63038df7f/_generated_background_page.html)
โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€6,100.59 MB (53.34%) -- classes
โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€6,095.92 MB (53.30%) -- class(Object)/objects
โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€5,125.00 MB (44.81%) -- malloc-heap
โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€3,891.99 MB (34.03%) โ”€โ”€ slots
โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€1,233.00 MB (10.78%) โ”€โ”€ elements/normal
โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€970.92 MB (08.49%) โ”€โ”€ gc-heap
โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€4.67 MB (00.04%) ++ (9 tiny)
โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€0.35 MB (00.00%) ++ (5 tiny)
โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€0.22 MB (00.00%) ++ (3 tiny)
โ”‚ โ”‚ โ””โ”€โ”€โ”€4,386.58 MB (38.35%) -- js-zone(0x7f13edffe000)
โ”‚ โ”‚ โ”œโ”€โ”€3,390.25 MB (29.64%) -- strings
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€2,754.86 MB (24.09%) ++ (2269 tiny)
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€โ”€โ”€243.28 MB (02.13%) โ”€โ”€ string(length=15, copies=10629069, "firefox-default")/gc-heap/latin1
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€โ”€โ”€242.93 MB (02.12%) โ”€โ”€ string(length=8, copies=10613831, "complete")/gc-heap/latin1
โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€149.17 MB (01.30%) -- string(length=71, copies=1504044, "moz-extension://6eb04b01-249e-4bcb-bd6f-9ce63038df7f/replaced/undefined")
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€114.75 MB (01.00%) โ”€โ”€ malloc-heap/latin1
โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€34.42 MB (00.30%) โ”€โ”€ gc-heap/latin1
โ”‚ โ”‚ โ”œโ”€โ”€โ”€โ”€958.44 MB (08.38%) โ”€โ”€ unused-gc-things
โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€37.89 MB (00.33%) ++ (11 tiny)
โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€6.10 MB (00.05%) ++ (10 tiny)
โ”œโ”€โ”€โ”€โ”€โ”€282.56 MB (02.47%) -- heap-overhead
โ”‚ โ”œโ”€โ”€172.06 MB (01.50%) โ”€โ”€ bookkeeping
โ”‚ โ””โ”€โ”€110.50 MB (00.97%) ++ (2 tiny)
โ”œโ”€โ”€โ”€โ”€โ”€178.19 MB (01.56%) ++ (25 tiny)
โ”œโ”€โ”€โ”€โ”€โ”€175.75 MB (01.54%) -- gfx
โ”‚ โ”œโ”€โ”€175.32 MB (01.53%) โ”€โ”€ heap-textures
โ”‚ โ””โ”€โ”€โ”€โ”€0.43 MB (00.00%) ++ (5 tiny)
โ”œโ”€โ”€โ”€โ”€โ”€159.78 MB (01.40%) ++ js-non-window
โ””โ”€โ”€โ”€โ”€โ”€146.73 MB (01.28%) ++ window-objects

bug solved

Most helpful comment

I fixed the problem that increased memory usage when restoring session or closing a large number of tabs. 90390af
Also, I added option to use "discarded" property for lazy loading. 45719c3
Enabling this option will improve performance when opening tabs.

All 9 comments

I found the same symptoms recently with Firefox 60 (maybe 60.0_1,1) on FreeBSD-CURRENT.

At the time, Firefox was almost certainly coincidentally affected by Mozilla bug 944918 - indexedDB broken - UnknownError - Error opening Database. Worked around in my case by removing .directory files from all subdirectories of the storage directory โ€ฆ

โ€ฆ time, now, for me to tell whether symptoms of this issue 249 are reproducible.

1,190 tabs across fifteen windows: restored in thirteen minutes, which is probably about right in my environment. Memory usage: normal. A frame from a screen recording:

2018-05-08 20 29 23 frame

@ponarC
Does the problem occur with the new profile?
I restored 2000 tabs with a new profile with many sessions (over 100), but no problem occurred.

Yes it can be reproduced after killing FF

Result from clean profile (only TSM)
17 windows, 835 tabs - exported and imported in clean profile (my typical FF content)

No memory overhead and no 100% CPU usage. But visible page loading sequentially around 4-5 tabs per second.
I have to wait for all tabs loading because i don't know when popup next windows.
After few minutes FF ready to work.

After kill FF and open again - this is typical reason when i need restore session (ff crash, no memory, computer crash)
FF instantly start restoring session (typically ask about that).
All windows and tabs created immediately but i noticed 100% CPU usage, freeze FF and visibly slowly memory grow (not to much to worry).
After few minutes FF ready to work.

Next kill and start
FF ask about restoring last session
Same as above
After few minutes FF ready to work (~5min cpu time). (memory peak ~40% and back to ~22%)

2,867.30 MB (100.0%) -- explicit
โ”œโ”€โ”€1,540.60 MB (53.73%) -- add-ons
โ”‚ โ”œโ”€โ”€1,537.74 MB (53.63%) -- Tab-Session-Manager@sienori/window-objects
โ”‚ โ”‚ โ”œโ”€โ”€1,535.90 MB (53.57%) -- top(moz-extension://3f4a1460-ac79-403d-8bbe-987ce104106c/_generated_background_page.html, id=12)
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€โ”€โ”€782.83 MB (27.30%) -- active/window(moz-extension://3f4a1460-ac79-403d-8bbe-987ce104106c/_generated_background_page.html)
โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€782.68 MB (27.30%) -- js-compartment(moz-extension://3f4a1460-ac79-403d-8bbe-987ce104106c/_generated_background_page.html)
โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€782.45 MB (27.29%) -- classes
โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€776.06 MB (27.07%) -- class(Object)/objects
โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€649.33 MB (22.65%) -- malloc-heap
โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€502.38 MB (17.52%) โ”€โ”€ slots
โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€146.95 MB (05.13%) โ”€โ”€ elements/normal
โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€126.72 MB (04.42%) โ”€โ”€ gc-heap
โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€6.39 MB (00.22%) ++ (14 tiny)
โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€0.23 MB (00.01%) ++ (4 tiny)
โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€0.15 MB (00.01%) ++ (3 tiny)
โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€753.07 MB (26.26%) -- js-zone(0x7f45d0f19000)
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€744.18 MB (25.95%) -- strings
โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€681.29 MB (23.76%) ++ (1736 tiny)
โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€โ”€31.61 MB (01.10%) โ”€โ”€ string(length=15, copies=1381055, "firefox-default")/gc-heap/latin1
โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€31.28 MB (01.09%) โ”€โ”€ string(length=8, copies=1366469, "complete")/gc-heap/latin1
โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€8.89 MB (00.31%) ++ (11 tiny)
โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€1.84 MB (00.06%) ++ (2 tiny)
โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€2.86 MB (00.10%) ++ (9 tiny)
โ”œโ”€โ”€โ”€โ”€709.86 MB (24.76%) โ”€โ”€ heap-unclassified
โ”œโ”€โ”€โ”€โ”€216.85 MB (07.56%) -- gfx
โ”‚ โ”œโ”€โ”€216.04 MB (07.53%) โ”€โ”€ heap-textures
โ”‚ โ””โ”€โ”€โ”€โ”€0.81 MB (00.03%) ++ (5 tiny)
โ”œโ”€โ”€โ”€โ”€123.99 MB (04.32%) ++ window-objects
โ”œโ”€โ”€โ”€โ”€119.03 MB (04.15%) -- heap-overhead
โ”‚ โ”œโ”€โ”€โ”€79.11 MB (02.76%) โ”€โ”€ bin-unused
โ”‚ โ”œโ”€โ”€โ”€39.19 MB (01.37%) โ”€โ”€ bookkeeping
โ”‚ โ””โ”€โ”€โ”€โ”€0.72 MB (00.03%) โ”€โ”€ page-cache
โ”œโ”€โ”€โ”€โ”€104.01 MB (03.63%) -- js-non-window
โ”‚ โ”œโ”€โ”€โ”€52.79 MB (01.84%) -- zones
โ”‚ โ”‚ โ”œโ”€โ”€47.71 MB (01.66%) ++ zone(0x7f45e893c000)
โ”‚ โ”‚ โ””โ”€โ”€โ”€5.08 MB (00.18%) ++ (4 tiny)
โ”‚ โ”œโ”€โ”€โ”€39.04 MB (01.36%) ++ runtime
โ”‚ โ””โ”€โ”€โ”€12.17 MB (00.42%) ++ gc-heap
โ””โ”€โ”€โ”€โ”€โ”€52.95 MB (01.85%) ++ (24 tiny)

Then go throught lot of tabs to force load content repeatdly shift+tab
Waiting for few min to load contend/cache/save session etc.
Reduced autosave in TSM to 1 min and wait 2 min

Then again kill FF and run.
Situation as above - 100% CPU, FF show all tabs (empty) and freeze, memory slowly grow.
After 5 min cpu time FF seams to be ready (i head first seconds from youtube) but then freeze again and noticed slowly memory grow up to 60%
After next 3.5 min FF really was ready (youtube start playing) and memory drop to ~25%

TEST END

Then kill FF again and back to restoring my original profile... (PC had power cut off)
Looks like last above
3.5 min for loading tabs (no memory issue, FF freeze)
few second ok
6.5 min for loading contend? (memory issue peak 95%, FF very slow)
back to normal 32% memory, FF work fine

8,498.50 MB (100.0%) -- explicit
โ”œโ”€โ”€7,450.14 MB (87.66%) -- add-ons
โ”‚ โ”œโ”€โ”€7,443.31 MB (87.58%) -- Tab-Session-Manager@sienori/window-objects
โ”‚ โ”‚ โ”œโ”€โ”€7,442.86 MB (87.58%) -- top(moz-extension://6eb04b01-249e-4bcb-bd6f-9ce63038df7f/_generated_background_page.html, id=18)
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€3,893.23 MB (45.81%) -- active/window(moz-extension://6eb04b01-249e-4bcb-bd6f-9ce63038df7f/_generated_background_page.html)
โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€3,893.01 MB (45.81%) -- js-compartment(moz-extension://6eb04b01-249e-4bcb-bd6f-9ce63038df7f/_generated_background_page.html)
โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€3,892.84 MB (45.81%) -- classes
โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€3,890.20 MB (45.78%) -- class(Object)/objects
โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€3,274.99 MB (38.54%) -- malloc-heap
โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€2,461.63 MB (28.97%) โ”€โ”€ slots
โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€813.36 MB (09.57%) โ”€โ”€ elements/normal
โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€615.22 MB (07.24%) โ”€โ”€ gc-heap
โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€2.63 MB (00.03%) ++ (9 tiny)
โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€0.17 MB (00.00%) ++ (4 tiny)
โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€0.22 MB (00.00%) ++ (3 tiny)
โ”‚ โ”‚ โ”‚ โ””โ”€โ”€3,549.63 MB (41.77%) -- js-zone(0x7f104d116000)
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€2,117.17 MB (24.91%) -- strings
โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€1,717.42 MB (20.21%) ++ (2325 tiny)
โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€โ”€โ”€153.67 MB (01.81%) โ”€โ”€ string(length=15, copies=6713877, "firefox-default")/gc-heap/latin1
โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€โ”€โ”€153.55 MB (01.81%) โ”€โ”€ string(length=8, copies=6708674, "complete")/gc-heap/latin1
โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€92.53 MB (01.09%) ++ string(length=71, copies=932955, "moz-extension://6eb04b01-249e-4bcb-bd6f-9ce63038df7f/replaced/undefined")
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€1,400.70 MB (16.48%) โ”€โ”€ unused-gc-things
โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€31.76 MB (00.37%) ++ (9 tiny)
โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€0.45 MB (00.01%) ++ top(moz-extension://6eb04b01-249e-4bcb-bd6f-9ce63038df7f/replaced/replaced.html?state=redirect&title=Index%20of%20/private/xnxx&url=http%3A//localhost/private/xnxx/&favIconUrl=http%3A//localhost/favicon.ico, id=131)
โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€6.83 MB (00.08%) ++ (10 tiny)
โ”œโ”€โ”€โ”€โ”€376.90 MB (04.43%) -- heap-overhead
โ”‚ โ”œโ”€โ”€236.15 MB (02.78%) โ”€โ”€ bin-unused
โ”‚ โ”œโ”€โ”€139.79 MB (01.64%) โ”€โ”€ bookkeeping
โ”‚ โ””โ”€โ”€โ”€โ”€0.96 MB (00.01%) โ”€โ”€ page-cache
โ”œโ”€โ”€โ”€โ”€202.08 MB (02.38%) -- gfx
โ”‚ โ”œโ”€โ”€201.45 MB (02.37%) โ”€โ”€ heap-textures
โ”‚ โ””โ”€โ”€โ”€โ”€0.63 MB (00.01%) ++ (5 tiny)
โ”œโ”€โ”€โ”€โ”€167.54 MB (01.97%) -- js-non-window
โ”‚ โ”œโ”€โ”€โ”€86.59 MB (01.02%) ++ zones
โ”‚ โ””โ”€โ”€โ”€80.95 MB (00.95%) ++ (2 tiny)
โ”œโ”€โ”€โ”€โ”€154.18 MB (01.81%) ++ (25 tiny)
โ””โ”€โ”€โ”€โ”€147.66 MB (01.74%) ++ window-objects

I had OOM/memory blowup problems on FF61/TSM3.1.2, and I was able to significantly reduce the memory usage by unchecking "Tab Lazy Loading". (I know that's the opposite of what it says.)

This was a mere 12 windows/143 tabs, resulting in 2 processes over 2GB each. (Task Manager by eyeball only, sorry.)

Perhaps there was some sort of change to tab restore in firefox recently?

Same here on FF 61 and TSM 3.20. Only usable by unchecking lazy tab loading.

Edit: Removing unrelated information that may or may not be attributable to TSM.

@sienori I experiencing the Problem as well on a Windows 7 PC. Only 50 Tabs across 3 Windows, which used to be a opened in a pinch of an eye struggling now for over 15 minutes before I kill it. I can't reproduce the way I finally can open Firefox w/o opening all the Tabs (previous session opens automaticaly).

Any help would appreciated. Thanks!

I have not been able to reproduce this problem.
It will be helpful if you tell me how to reproduce in the following format.

## Steps to reproduce
<!-- Detailed steps to reproduce the problem. -->
1. Start Firefox with clean profile
2. Install Tab Session Manager
3. 
4. 

## Expected result
<!-- If you have any screenshot or screencast, it will help me more. -->

## Actual result
<!-- If you have any screenshot or screencast, it will help me more. -->

## Platform information
* Platform (OS): 
* Version of Firefox: 
* Version of Tab Session Manager: 

I fixed the problem that increased memory usage when restoring session or closing a large number of tabs. 90390af
Also, I added option to use "discarded" property for lazy loading. 45719c3
Enabling this option will improve performance when opening tabs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Aezaeo picture Aezaeo  ยท  5Comments

jar311 picture jar311  ยท  4Comments

irvinm picture irvinm  ยท  4Comments

gramireus picture gramireus  ยท  5Comments

moonlit picture moonlit  ยท  3Comments