argon2-wasm icon indicating copy to clipboard operation
argon2-wasm copied to clipboard

High wasm memory usage

Open Fang- opened this issue 6 years ago • 2 comments

I realize this is very little to go on, but want to document it anyway. Might be a browser issue, might be a wasm issue, might be a configuration issue, who knows.

Using Firefox, having left Bridge sit idly open overnight, and then running a measurement on about:memory, I saw a good 11 GB allocated for the page.

Firefox memory measurement
Web Content (pid 54939)
Explicit Allocations

11,868.59 MB (100.0%) -- explicit
├──11,215.59 MB (94.50%) -- window-objects
│  ├──11,126.95 MB (93.75%) -- top(https://localhost:3000/, id=12884901899)
│  │  ├──10,637.47 MB (89.63%) -- active/window(https://localhost:3000/)
│  │  │  ├──10,485.84 MB (88.35%) -- js-realm(https://localhost:3000/)
│  │  │  │  ├──10,316.61 MB (86.92%) -- classes
│  │  │  │  │  ├───9,880.71 MB (83.25%) -- class(ArrayBuffer)/objects
│  │  │  │  │  │   ├──9,880.00 MB (83.24%) ── non-heap/elements/wasm [19]
│  │  │  │  │  │   └──────0.71 MB (00.01%) ++ (2 tiny)
│  │  │  │  │  ├─────236.12 MB (01.99%) -- class(Object)/objects
│  │  │  │  │  │     ├──123.83 MB (01.04%) ++ malloc-heap
│  │  │  │  │  │     └──112.29 MB (00.95%) ── gc-heap [24]
│  │  │  │  │  └─────199.79 MB (01.68%) ++ (9 tiny)
│  │  │  │  └─────169.23 MB (01.43%) ++ (7 tiny)
│  │  │  └─────151.63 MB (01.28%) ++ (4 tiny)
│  │  └─────489.47 MB (04.12%) ++ (24 tiny)
│  └──────88.64 MB (00.75%) ++ (6 tiny)
├─────371.80 MB (03.13%) ── heap-unclassified
├─────177.96 MB (01.50%) ++ js-non-window
└─────103.25 MB (00.87%) ++ (23 tiny)

Other Measurements

26.38 MB (100.0%) -- decommitted
└──26.38 MB (100.0%) ── js-non-window/gc-heap/decommitted-arenas

2,208 (100.0%) -- event-counts
└──2,208 (100.0%) -- window-objects
   ├────705 (31.93%) -- top(https://localhost:3000/, id=12884901899)/active/window(https://localhost:3000/)/dom
   │    ├──696 (31.52%) ── event-listeners [24]
   │    └────9 (00.41%) ── event-targets
   └──── [etc]

1,373.68 MB (100.0%) -- heap-committed
├──1,338.95 MB (97.47%) ── allocated
└─────34.73 MB (02.53%) ── overhead

11,204.27 MB (100.0%) -- js-main-runtime
├──10,568.93 MB (94.33%) -- realms
│  ├──10,383.31 MB (92.67%) -- classes/objects
│  │  ├───9,884.19 MB (88.22%) -- non-heap
│  │  │   ├──9,880.00 MB (88.18%) ── elements/wasm
│  │  │   └──────4.19 MB (00.04%) ── code/wasm
│  │  ├─────332.14 MB (02.96%) ── gc-heap
│  │  └─────166.98 MB (01.49%) -- malloc-heap
│  │        ├──132.44 MB (01.18%) ── elements/normal
│  │        └───34.55 MB (00.31%) ++ (2 tiny)
│  └─────185.62 MB (01.66%) ++ (11 tiny)
├─────547.05 MB (04.88%) -- zones
│     ├──283.40 MB (02.53%) ++ (17 tiny)
│     └──263.64 MB (02.35%) ── type-pool
└──────88.30 MB (00.79%) ++ (2 tiny)

606.62 MB (100.0%) -- js-main-runtime-gc-heap-committed
├──597.37 MB (98.48%) -- used
│  ├──577.54 MB (95.21%) -- gc-things
│  │  ├──332.14 MB (54.75%) ── objects
│  │  ├───92.61 MB (15.27%) ── object-groups
│  │  ├───72.71 MB (11.99%) ── shapes
│  │  ├───41.82 MB (06.89%) ── scripts
│  │  ├───15.38 MB (02.53%) ── lazy-scripts
│  │  ├───11.51 MB (01.90%) ── scopes
│  │  ├────7.36 MB (01.21%) ── strings
│  │  └────4.01 MB (00.66%) ++ (4 tiny)
│  ├────9.95 MB (01.64%) ── arena-admin
│  └────9.88 MB (01.63%) ── chunk-admin
└────9.25 MB (01.52%) -- unused
     ├──8.25 MB (01.36%) ++ gc-things
     └──1.00 MB (00.16%) ++ (2 tiny)

233 (100.0%) -- js-main-runtime-realms
├──227 (97.42%) -- user
│  ├───48 (20.60%) ++ (45 tiny)
│  ├───24 (10.30%) ── [etc]
│  ├───24 (10.30%) ── https://localhost:3000/ [24]
│  ├────5 (02.15%) ── [etc]
└────6 (02.58%) ++ system

1,388 (100.0%) -- observer-service-suspect
├────509 (36.67%) ── referent(topic=memory-pressure)
├────410 (29.54%) ── referent(topic=xpcom-shutdown)
├────213 (15.35%) ── referent(topic=chrome-flush-skin-caches)
├────129 (09.29%) ── referent(topic=wake_notification)
└────127 (09.15%) ── referent(topic=font-info-updated)

      0.00 MB ── gfx-surface-quartz
      0.00 MB ── gfx-textures
      0.00 MB ── gfx-textures-peak
      0.00 MB ── gfx-tiles-waste
            0 ── ghost-windows
  1,338.95 MB ── heap-allocated
      1.00 MB ── heap-chunksize
  1,673.00 MB ── heap-mapped
      0.01 MB ── imagelib-surface-cache-estimated-locked
      0.01 MB ── imagelib-surface-cache-estimated-total
            0 ── imagelib-surface-cache-overflow-count
     51.67 MB ── js-main-runtime-temporary-peak
           27 ── page-faults-hard
   15,777,397 ── page-faults-soft
     81.79 MB ── resident
  3,459.25 MB ── resident-peak
     23.98 MB ── resident-unique
      0.69 MB ── script-preloader-memmapped-cache
            0 ── unresolved-ipc-responses
124,247.59 MB ── vsize
 11,248.13 MB ── wasm-guard-pages [2]
      0.00 MB ── wasm-runtime

But then, making a memory snapshot on the page itself using dev console shows nothing interesting at all:

image

Fang- avatar Apr 07 '19 10:04 Fang-

Did the OS also report high memory usage? If not, this might just be WASM virtual memory that the browser has "allocated," which isn't necessarily a problem.

belisarius222 avatar Apr 07 '19 16:04 belisarius222

Yes, the reason I noticed was that the OS was complaining about memory pressure. I did not do any logging on the OS-level though.

Fang- avatar Apr 07 '19 18:04 Fang-