Closed Bug 828886 Opened 12 years ago Closed 7 years ago

Displaying webpage with retina display shows 2GB RSS but only 300MB explicit memory.

Categories

(Core :: Graphics, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: gwagner, Assigned: milan)

References

(Blocks 1 open bug, )

Details

(Whiteboard: [MemShrink:P2])

Attachments

(2 files)

When opening this page I see around 2GB memory usage. If I click on another tab, the memory goes back to around 600MB.

About:memory only shows 300MB explicit memory for the 2GB RSS case.
I couldn't reproduce it with my old MBP without the retina display.
Whiteboard: memshrink → [MemShrink]
Dietrich, can you do us a favor and not modify this page (or, if you do want to change it, make a copy first)?
Gregor, can you attach a copy of about:memory?  Just copy and paste the text into a file.
Attached file about:memory (deleted) —
about:memory dump
How odd.  jemalloc clearly isn't allocating all that memory.  So I figure it must be either:

- The system allocator (a la bug 828844)

- Some mmap'd stuff.

Unfortunately we have no insight into either of those kinds of allocations :(
Oh, but I just learned about vmmap.  Run |vmmap <pid>| from the command line and you get tons of info (note that it takes a few seconds to run).  Hopefully that'll make it obvious.  The -resident flag might be helpful.
Attached file vmmap + about:memory (deleted) —
Comment on attachment 700874 [details]
vmmap + about:memory

Looks like it's coming from a bunch of ~15mb mappings like

MALLOC_LARGE           00000001ea200000-00000001eb0fc000 [ 15.0M] rw-/rwx SM=PRV  GFXMallocZone_0x100086000
VM_ALLOCATE            00000001eb0fc000-00000001ebffc000 [ 15.0M] rw-/rw- SM=ALI  

It's gotta be the radial gradient, right?  There's nothing else in that page...
Just tested this with Gregor.  Disabling the radial gradient didn't make a difference, but deleting the "ray" <div>s helped a ton.

  <div class="ray" style="transform: rotate(194.4deg);"></div>
  
  .ray {
    background-color: rgba(255, 255, 255, 0.1);
    width: 150%;
    height: 10px;
    position: fixed;
    top: 50%;
    left: -25%;
    z-index: -1;
  }
+cc: Jonathan. Can you comment on the memory usage in the dynamically generated divs here? There doesn't seem to be much in there but text.
Whiteboard: [MemShrink] → [MemShrink:P2]
To Milan for assignment. See comment 7 for the suspect allocations (GFXMallocZone_0x100086000)
Assignee: nobody → milan
(In reply to Justin Lebar [:jlebar] from comment #8)
> Just tested this with Gregor.  Disabling the radial gradient didn't make a
> difference, but deleting the "ray" <div>s helped a ton.
> 
>   <div class="ray" style="transform: rotate(194.4deg);"></div>
>   
>   .ray {
>     background-color: rgba(255, 255, 255, 0.1);
>     width: 150%;
>     height: 10px;
>     position: fixed;
>     top: 50%;
>     left: -25%;
>     z-index: -1;
>   }

It looks like the page creates 50 of these <div>s, and many of them (depending on their angle) will have a pretty large bounding box. I don't know how Layers would handle this, but if we're creating a separate layer and opengl backing surface for each of these (are we?), that'd add up to a lot of allocation for all those surfaces. On a retina display, they'd be 4x the size that they are on a similar-sized non-retina display, as they'll be created at device resolution.

Where would memory for opengl backing store show up - can/do we track that?
> Where would memory for opengl backing store show up - can/do we track that?

I don't think we do track these.  I'd love it if we could, but it's hard; the allocations don't even go through malloc().

I guess we could do something like

    StartingOGLCallOnThisThread();
    [OGL stuff]
    StoppingOGLCallOnThisThread();

and then intercept mmap() between the Start and Stop calls...
> On a retina display, they'd be 4x the size that they are on a similar-sized non-retina 
> display, as they'll be created at device resolution.

Okay, I see a ~330mb jump when I focus the tab, so 4x that is 1300mb, which roughly corresponds to the increase Gregor saw.  Good to know this isn't a retina-only problem.
johns suggests that perhaps there's an Apple OGL extension which would let us query how much memory the graphics driver is using.
I think we would be better served by estimating our GL memory usage ourselves, which should work on all platforms, and is something we've wanted to do for a while.
In the context of using too much memory - Avi, Jeff, is this the gradient cache miss issue?
(In reply to Milan Sreckovic [:milan] from comment #16)
> In the context of using too much memory - Avi, Jeff, is this the gradient
> cache miss issue?

The cache misses issue we were dealing with at bug 837542 and bug 838758 is strictly a Windows/D2D issue. So I would say it's probably not the same issue.
Thanks Avi, didn't realize Windows/D2D is the only place where we cache the gradients.
Milan do you know if this is still an issue or should we just close it? The test site is gone so I can't confirm one way or another.
Flags: needinfo?(milan)
Let's deal with issues we can reproduce and work with.
Status: NEW → RESOLVED
Closed: 7 years ago
Flags: needinfo?(milan)
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: