Open Bug 724677 Opened 8 years ago Updated 8 years ago

50% memory spike upon exiting private browsing mode

Categories

(Firefox :: Private Browsing, defect)

x86_64
macOS
defect
Not set

Tracking

()

People

(Reporter: ashughes, Unassigned)

References

(Depends on 1 open bug)

Details

(Whiteboard: [MemShrink:P3])

Attachments

(3 files, 2 obsolete files)

We discovered today that there is a 50% memory spike when exiting from Private Browsing mode. It was originally discovered by our Mozmill Endurance tests (see bug 724553).

The short version is that if you have many tabs open when entering Private Browsing, you will experience a temporary spike in memory usage upon exiting Private Browsing.

To reproduce manually:
1) Start Firefox Nightly on a new profile
2) Open 10 new tabs to different pages (I just CMD+click open links from the first run page)
3) Enter private browsing mode
4) Quit private browsing mode

My general results are:
 * ~120MB initially.
 * ~190MB after loading 10 tabs
 * ~160MB after entering Private Browsing
 * ~260MB upon exiting Private Browsing
 * ~150MB a couple minutes after exiting Private Browsing

Note, on Mac the spike is about 50% while on Windows and Linux it is only about 25% so I'm not sure if this is the same issue across all platforms.

Also note that I suspect the following check-in has made this issue more visible. However, I don't believe it caused it:
http://hg.mozilla.org/mozilla-central/rev/c18523b51058
Bug 716014 - Use CompartmentGC more often

I'm not sure if this relates to bug 639515 in any way.
Blocks: 724553
What do you see in about:memory before and after exiting the private browsing mode?
Attached file About:Memory PB.on (obsolete) —
Here is the about:memory log from when I am in Private Browsing mode.
Attached file About:Memory PB.off (obsolete) —
Here is my about:memory log shortly after exiting PB mode and restoring the 10 loaded tabs.
Can you please load the same tabs inside PB mode and after you leave it?  It's hard to compare the two if the set of loaded pages changes.
Is this surprising?  Doesn't exiting PB mode cause all the old pages to be reloaded all at once?  Of course that causes a memory consumption spike...
I thought this bug is comparing the pre-PB memory usage with post-PB.  If it's about pre-leave-PB vs. post-leave-PB, then yes it's not very surprising.
Attached file About:Memory before PB
Here is the about:memory log before entering private browsing.
Attached file About:Memory PB.on
About:Memory log after entering Private Browsing and loading the same 10 pages
Attachment #594811 - Attachment is obsolete: true
(In reply to Ehsan Akhgari [:ehsan] from comment #6)
> I thought this bug is comparing the pre-PB memory usage with post-PB.  If
> it's about pre-leave-PB vs. post-leave-PB, then yes it's not very surprising.

Even then, loading pages is likely to create lots of garbage.  It would take some GCs/CCs for the memory usage to settle.
Attached file About:Memory PB.off
About:Memory after exiting Private Browsing and waiting for the 10 tabs to restore.
Attachment #594816 - Attachment is obsolete: true
Ehsan, 3 new logs for you are attached.

Nicholas, I would certainly expect a certain amount of resident memory spike. However, I would not expect a 50% spike, and I would certainly not expect that spike to be 2x worse on Mac than on Windows and Linux.

Kyle, same as above for GC/CC. I would expect there to be something, but not as bad as it is. If the reported behaviour is "expected", I suggest we improve our expectations and make this not suck as much as it does. Especially considering that my test involves 10 relativley light-weight Mozilla pages, not 10 pages heavier and more common pages like Facebook and Youtube.
Duplicate of this bug: 725701
(In reply to Anthony Hughes, Mozilla QA (irc: ashughes) from comment #12)
> Duplicate of this bug: 725701

Sorry, duped to the wrong bug.
OS: Mac OS X → All
Hardware: x86_64 → All
I think we should investigate this.
OS: All → Mac OS X
Hardware: All → x86_64
Whiteboard: [MemShrink]
> * ~160MB after entering Private Browsing
> * ~260MB upon exiting Private Browsing
> * ~150MB a couple minutes after exiting Private Browsing

This looks like exiting PB isn't triggering a GC/CC.  It should.  We'll fix that in bug 709326.
Depends on: 709326
Whiteboard: [MemShrink] → [MemShrink:P2]
Whiteboard: [MemShrink:P2] → [MemShrink:P3]
You need to log in before you can comment on or make changes to this bug.