Closed
Bug 1241370
Opened 10 years ago
Closed 10 years ago
Don't strdup() the message name in InterruptFrame
Categories
(Core :: IPC, defect)
Core
IPC
Tracking
()
RESOLVED
FIXED
mozilla46
| Tracking | Status | |
|---|---|---|
| firefox46 | --- | fixed |
People
(Reporter: n.nethercote, Assigned: n.nethercote)
Details
Attachments
(1 file)
|
1.61 KB,
patch
|
billm
:
review+
|
Details | Diff | Splinter Review |
I did some cumulative heap profiling with DMD. While playing an 8 minute video
on YouTube on Mac, 1.7% (438,000) of all calls to malloc were due to the
strdup() call in InterruptFrame()'s constructor. Those strings are only used in
IPC error messages.
The strings don't need to be strdup()'d because Message::name_ is always a
string literal:
- The Message() constructor that sets name_ is always passed a string literal
(mostly in IPDL-generated code), or nothing, in which case "???" is
used.
- Message::set_name() is also always passed a string literal (again, mostly in
IPDL_generated code).
It would be nice if we could guarantee that it's always a string literal and
thus has the same lifetime as the program, but I don't think that's possible in
C++.
Also, the lifetime of InterruptFrame objects appears to be the same as that of
CxxStackFrame objects (because they're created in CxxStackFrame's ctor and
destroyed in CxxStackFrame's dtor), and CxxStackFrame is a stack-only class,
and it's always instantiated in a function that takes a |Message| as an
argument, so even if some of the names were not string literals I think the
lifetimes work out safely.
| Assignee | ||
Comment 1•10 years ago
|
||
Attachment #8710246 -
Flags: review?(wmccloskey)
Comment on attachment 8710246 [details] [diff] [review]
Don't strdup() the message name in InterruptFrame
Review of attachment 8710246 [details] [diff] [review]:
-----------------------------------------------------------------
Also, we only ever use the string if we're about to crash :-). Nice find.
Attachment #8710246 -
Flags: review?(wmccloskey) → review+
| Assignee | ||
Comment 3•10 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/5d12e137f2c154dbbffb2cf9912709bcf9f594aa
Bug 1241370 - Don't strdup() the message name in InterruptFrame. r=billm.
Comment 4•10 years ago
|
||
| bugherder | ||
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
status-firefox46:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla46
You need to log in
before you can comment on or make changes to this bug.
Description
•