Open
Bug 691174
Opened 13 years ago
Updated 2 years ago
Investigate reducing calls to malloc() from nsStringBuffer.
Categories
(Core :: XPCOM, defect)
Core
XPCOM
Tracking
()
NEW
People
(Reporter: justin.lebar+bug, Unassigned)
References
Details
(Whiteboard: [MemShrink:P2])
My analysis from bug 688979 indicates that about 8% of mallocs in the browser are from strings:
109135 malloc's ( 4%):
malloc at memory/jemalloc/jemalloc.c:6075
nsStringBuffer::Alloc(unsigned long) at xpcom/string/src/nsSubstring.cpp:210
nsAString_internal::MutatePrep(unsigned int, unsigned short**, unsigned int*) at xpcom/string/src/nsTSubstring.cpp:164
98183 malloc's ( 4%):
malloc at memory/jemalloc/jemalloc.c:6075
nsStringBuffer::Alloc(unsigned long) at xpcom/string/src/../../../../src/xpcom/string/src/nsSubstring.cpp:210
nsACString_internal::MutatePrep(unsigned int, char**, unsigned int*) at xpcom/string/src/../../../../src/xpcom/string/src/nsTSubstring.cpp:164
(In this test run, I started up the browser, loaded gmail, nytimes, slashdot, and CNN, and then closed the browser.)
Using nsAutoTArray instead of nsTArray in the CSS engine resulted in a 2-3% RSS reduction (bug 681755 comment 31). It's possible we'd see a similar improvement by using nsAuto{C,}String in place of ns{C,}String in a few key places.
Reporter | ||
Updated•13 years ago
|
Whiteboard: [MemShrink]
Comment 1•13 years ago
|
||
How does one gather the stats to know if there are stack strings which are easy wins?
Reporter | ||
Comment 2•13 years ago
|
||
In theory, the analysis can use deeper backtraces, which would let us see where those strings are being allocated. That, plus an indication of how long those allocations last, would help us find stack strings which are easy wins.
But for some reason it starts giving me funky backtraces around depth 6 or 7, which is how deep you need to go to break out of the string code. Once I figure this out, I'll post more data in this bug.
Reporter | ||
Updated•13 years ago
|
Assignee: nobody → justin.lebar+bug
Whiteboard: [MemShrink] → [MemShrink:P2]
Reporter | ||
Updated•12 years ago
|
Assignee: justin.lebar+bug → nobody
Assignee | ||
Updated•4 years ago
|
Component: String → XPCOM
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•