I'm currently working on a bot for Neverwinter that uses the gateway to do professions, but I've run into an issue where Gecko just keeps getting larger and larger. After making sure I have no leaks in my own code, I've looked into about:memory.
Here is the about:memory dump:
Code:
Main Process
Explicit Allocations
494.12 MB (100.0%) -- explicit
├──451.86 MB (91.45%) -- window-objects
│ ├──451.85 MB (91.45%) -- top(about:memory, id=1)/active
│ │ ├──451.16 MB (91.31%) -- window(http://gateway.playneverwinter.com/)
│ │ │ ├──261.68 MB (52.96%) -- dom
│ │ │ │ ├──261.68 MB (52.96%) ── orphan-nodes
│ │ │ │ └────0.00 MB (00.00%) ++ (2 tiny)
│ │ │ └──189.48 MB (38.35%) -- js/compartment(http://gateway.playneverwinter.com/)
│ │ │ ├──101.61 MB (20.56%) -- string-chars
│ │ │ │ ├───91.39 MB (18.49%) ── non-huge
│ │ │ │ └───10.23 MB (02.07%) ++ huge
│ │ │ ├───63.39 MB (12.83%) -- gc-heap
│ │ │ │ ├──55.14 MB (11.16%) -- objects
│ │ │ │ │ ├──30.90 MB (06.25%) ── ordinary
│ │ │ │ │ ├──17.52 MB (03.55%) ── dense-array
│ │ │ │ │ └───6.72 MB (01.36%) ── function
│ │ │ │ ├───5.33 MB (01.08%) ++ strings
│ │ │ │ └───2.92 MB (00.59%) ++ (6 tiny)
│ │ │ ├───20.46 MB (04.14%) -- objects-extra
│ │ │ │ ├──14.87 MB (03.01%) ── elements
│ │ │ │ └───5.59 MB (01.13%) ++ (3 tiny)
│ │ │ └────4.01 MB (00.81%) ++ (7 tiny)
│ │ └────0.70 MB (00.14%) ++ window(about:memory)
│ └────0.00 MB (00.00%) ++ top(none)/detached/window(view-source:https://gateway.playneverwinter.com/#char%28%29/professions)/dom
├───16.18 MB (03.27%) -- js-non-window
│ ├───9.61 MB (01.94%) -- gc-heap
│ │ ├──8.43 MB (01.71%) ── decommitted-arenas
│ │ └──1.17 MB (00.24%) ++ (3 tiny)
│ └───6.57 MB (01.33%) ++ (2 tiny)
├───13.21 MB (02.67%) ── heap-unclassified
└───12.88 MB (02.61%) ++ (15 tiny)
Other Measurements
25 (100.0%) -- js-compartments
├──19 (76.00%) ── system
└───6 (24.00%) ── user
206.21 MB (100.0%) -- js-main-runtime
├──193.11 MB (93.64%) -- compartments
│ ├──102.33 MB (49.62%) -- string-chars
│ │ ├───92.10 MB (44.66%) ── non-huge
│ │ └───10.23 MB (04.96%) ++ huge
│ ├───65.39 MB (31.71%) -- gc-heap
│ │ ├──55.52 MB (26.92%) -- objects
│ │ │ ├──31.05 MB (15.06%) ── ordinary
│ │ │ ├──17.53 MB (08.50%) ── dense-array
│ │ │ ├───6.92 MB (03.35%) ── function
│ │ │ └───0.02 MB (00.01%) ── cross-compartment-wrapper
│ │ ├───5.71 MB (02.77%) -- strings
│ │ │ ├──4.45 MB (02.16%) ── normal
│ │ │ └──1.26 MB (00.61%) ── short
│ │ └───4.16 MB (02.02%) ++ (6 tiny)
│ ├───20.59 MB (09.99%) -- objects-extra
│ │ ├──14.88 MB (07.22%) ── elements
│ │ ├───5.05 MB (02.45%) ── slots
│ │ └───0.66 MB (00.32%) ++ (2 tiny)
│ ├────2.96 MB (01.44%) -- type-inference
│ │ ├──2.41 MB (01.17%) ── analysis-pool
│ │ └──0.56 MB (00.27%) ++ (3 tiny)
│ └────1.83 MB (00.89%) ++ (8 tiny)
├────9.61 MB (04.66%) -- gc-heap
│ ├──8.43 MB (04.09%) ── decommitted-arenas
│ └──1.17 MB (00.57%) ++ (3 tiny)
└────3.50 MB (01.70%) ── runtime
66.57 MB (100.0%) -- js-main-runtime-gc-heap-committed
├──64.53 MB (96.94%) -- used
│ ├──62.92 MB (94.52%) ── gc-things
│ ├───1.17 MB (01.76%) ── chunk-admin
│ └───0.44 MB (00.65%) ── arena-admin
└───2.04 MB (03.06%) -- unused
├──2.04 MB (03.06%) ── gc-things
└──0.00 MB (00.00%) ++ (2 tiny)
0 (100.0%) -- low-memory-events
├──0 (100.0%) ── physical
└──0 (100.0%) ── virtual
261.82 MB (100.0%) -- window-objects
├──261.69 MB (99.95%) -- dom
│ ├──261.68 MB (99.95%) ── orphan-nodes
│ └────0.01 MB (00.00%) ++ (6 tiny)
└────0.13 MB (00.05%) ++ (3 tiny)
494.05 MB ── explicit
0.40 MB ── gfx-d2d-surfacecache
4.00 MB ── gfx-d2d-surfacevram
3.78 MB ── gfx-d2d-vram-drawtarget
2.11 MB ── gfx-d2d-vram-sourcesurface
2.67 MB ── gfx-surface-image
0.00 MB ── gfx-textures
0 ── ghost-windows
417.86 MB ── heap-allocated
429.54 MB ── heap-committed
11.70 MB ── heap-committed-unused
2.80% ── heap-committed-unused-ratio
2.00 MB ── heap-dirty
26.13 MB ── heap-unused
2.71 MB ── images-content-used-uncompressed
75.00 MB ── js-gc-heap
0 ── low-commit-space-events
560.52 MB ── private
591.84 MB ── resident
3.21 MB ── storage-sqlite
950.25 MB ── vsize
Currently, I'm attempting to use these options to limit Gecko, it reduces the amount of memory it seems to consume per round of rewards/job starts, but it doesn't seem to be of much use in preventing half a gig of memory from being consumed. Currently, the program seems to have stalled out at about 450mb of memory consumption with these options. (where before it seemed like it would just keep on getting larger)
Code:
GeckoPreferences.User.Item("browser.cache.memory.enable") = False
GeckoPreferences.User.Item("browser.cache.disk.enable") = False
GeckoPreferences.User.Item("browser.cache.check doc frequency") = 3
GeckoPreferences.User.Item("browser.cache.offline.enable") = False
GeckoPreferences.User.Item("javascript.options.mem.max") = 50000
GeckoPreferences.User.Item("javascript.options.mem.gc_frequency") = 5
GeckoPreferences.User.Item("image.mem.min_discard_timeout_ms") = 5000 ' 5 seconds, then discard.
GeckoPreferences.User.Item("browser.sessionhistory.max_total_viewers") = 0
Is there any way i can force Gecko to consume less memory? or does the problem lie in badly coded JavaScript on their end?