Open Bug 1436734 Opened 6 years ago Updated 29 days ago

pdf with many images uses a lot of memory on scrolling

Categories

(Firefox :: PDF Viewer, defect, P3)

defect

Tracking

()

Performance Impact ?

People

(Reporter: mayankleoboy1, Unassigned)

References

()

Details

(Keywords: memory-footprint, perf, Whiteboard: [pdfjs-performance])

Attachments

(5 files)

Attached file aboutsupport.txt
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:60.0) Gecko/20100101 Firefox/60.0
Build ID: 20180208103049

Steps to reproduce:

1. On normal nightly profile
2. Open the pdf attached
3. Start scrolling from page 97 (This is because there are lots of images in quick succession starting from this page)
4. Scroll till page 115 (From this point onward, images are very less)
4. Huge memory increase. Till 3.8GB


Actual results:

Huge memory increase
Also OOM+crash
https://crash-stats.mozilla.com/report/index/7564658b-4b49-4d96-9123-c071d0180208


Expected results:

not so
Attached file memory-report.json.gz
about:memory
File is 12mb in size, so cant upload here. 
Heres the direst link:

http://idav.ucdavis.edu/~dfalcant//downloads/dissertation.pdf
Summary: pdf with many images will OOM on scrolling → pdf with many images will OOM on scrolling (about:memory and pdf link attached)
This also happens on a new profile.
Note: Memory decreases after you switch tabs and wait for some time. So appears to be a images related issue.
Component: Graphics → Layout: Images
I tried to reproduce, the biggest I could get memory use for the content process as shown by activity monitor was about 1 GB. I did an about:memory quickly snapshot several times when I hit a peak memory usage and I never saw images taking much memory at all. The memory report attached also doesn't have much memory being used by images. My memory reports looked like this

747.83 MB (100.0%) -- explicit
├──386.42 MB (51.67%) -- workers/workers(pdf.js)/worker(../build/pdf.worker.js, 0x11e2d6000)
│  ├──375.07 MB (50.15%) -- zone(0x12493a000)
│  │  ├──341.63 MB (45.68%) -- compartment(web-worker)
│  │  │  ├──334.50 MB (44.73%) -- classes
│  │  │  │  ├──302.60 MB (40.46%) -- class(ArrayBuffer)/objects
│  │  │  │  │  ├──302.42 MB (40.44%) ── malloc-heap/elements/normal
│  │  │  │  │  └────0.17 MB (00.02%) ── gc-heap
│  │  │  │  ├───24.07 MB (03.22%) ++ (12 tiny)
│  │  │  │  └────7.84 MB (01.05%) ++ class(Array)/objects
│  │  │  └────7.13 MB (00.95%) ++ (8 tiny)
│  │  ├───16.85 MB (02.25%) ── unused-gc-things
│  │  └───16.59 MB (02.22%) ++ (14 tiny)
│  ├────8.51 MB (01.14%) ++ runtime
│  └────2.84 MB (00.38%) ++ (2 tiny)
├──212.06 MB (28.36%) -- window-objects/top(http://idav.ucdavis.edu/~dfalcant//downloads/dissertation.pdf, id=8589934593)
│  ├──204.49 MB (27.34%) -- active/window(http://idav.ucdavis.edu/~dfalcant//downloads/dissertation.pdf)
│  │  ├──201.10 MB (26.89%) -- js-compartment(resource://pdf.js/web/viewer.html, http://idav.ucdavis.edu/~dfalcant//downloads/dissertation.pdf)
│  │  │  ├──198.18 MB (26.50%) -- classes
│  │  │  │  ├──182.75 MB (24.44%) -- class(ArrayBuffer)/objects
│  │  │  │  │  ├──182.28 MB (24.37%) ── malloc-heap/elements/normal
│  │  │  │  │  └────0.47 MB (00.06%) ── gc-heap
│  │  │  │  ├───11.04 MB (01.48%) ++ class(Array)/objects
│  │  │  │  └────4.39 MB (00.59%) ++ (12 tiny)

So it looks like the right component is for the pdf.js viewer.
Component: Layout: Images → PDF Viewer
Product: Core → Firefox
It seems I can reproduce this bug, although not a OOM crash.

See the attached screenshots for memory and CPU usage. The first half is while scrolling, the second after.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P3
Severity: normal → S4
Summary: pdf with many images will OOM on scrolling (about:memory and pdf link attached) → pdf with many images uses a lot of memory on scrolling
Whiteboard: [pdfjs-performance]
Attached file dissertation.7z
Performance Impact: --- → ?
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: