Closed
Bug 1295101
Opened 9 years ago
Closed 9 years ago
ctypes.jsm uses a lot of memory due to resolving lazy properties on the global
Categories
(Core :: js-ctypes, defect)
Core
js-ctypes
Tracking
()
RESOLVED
FIXED
mozilla51
| Tracking | Status | |
|---|---|---|
| firefox51 | --- | fixed |
People
(Reporter: jandem, Assigned: jandem)
References
Details
(Whiteboard: [MemShrink])
Attachments
(1 file)
|
1.02 KB,
patch
|
bholley
:
review+
|
Details | Diff | Splinter Review |
ctypes.cpp has the following code:
// Finally, seal the global object, for good measure. (But not recursively;
// this breaks things.)
return JS_FreezeObject(cx, global);
This ends up resolving lazy properties on the global. Due to all the DOM prototype objects, this is relatively slow and uses a lot of memory.
Removing this line wins about 180 KB per content process (242,864 -> 64,832 bytes)
Before:
│ │ │ ├────242,864 B (00.54%) -- compartment([System Principal], resource://gre/modules/ctypes.jsm)
│ │ │ │ ├──198,160 B (00.44%) -- classes
│ │ │ │ │ ├───88,800 B (00.20%) ++ shapes
│ │ │ │ │ ├───74,144 B (00.17%) ++ class(Function)/objects
│ │ │ │ │ └───35,216 B (00.08%) ++ class(<non-notable classes>)/objects
│ │ │ │ ├───32,896 B (00.07%) ── compartment-tables
│ │ │ │ └───11,808 B (00.03%) -- sundries
│ │ │ │ ├──10,848 B (00.02%) ── malloc-heap
│ │ │ │ └─────960 B (00.00%) ── gc-heap
After:
│ │ │ ├─────64,832 B (00.15%) -- compartment([System Principal], resource://gre/modules/ctypes.jsm)
│ │ │ │ ├──48,400 B (00.11%) -- classes
│ │ │ │ │ ├──29,264 B (00.07%) ++ class(<non-notable classes>)/objects
│ │ │ │ │ └──19,136 B (00.04%) ++ shapes
│ │ │ │ └──16,432 B (00.04%) ++ sundries
| Assignee | ||
Comment 1•9 years ago
|
||
This "seal the global" code was added 7 years ago (bug 513788). It might be less useful now since CPG and it's likely not worth the 180 KB memory per process.
Attachment #8781073 -
Flags: review?(jorendorff)
Updated•9 years ago
|
Blocks: e10s-multi
Whiteboard: [MemShrink]
Updated•9 years ago
|
Attachment #8781073 -
Flags: review?(jorendorff) → review+
Comment 2•9 years ago
|
||
Nice.
Pushed by jandemooij@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/c70cf61a5f1d
Don't freeze the ctypes.jsm global to avoid resolving all properties on it. r=bholley
Comment 4•9 years ago
|
||
| bugherder | ||
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
status-firefox51:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla51
You need to log in
before you can comment on or make changes to this bug.
Description
•