Closed
Bug 499027
Opened 15 years ago
Closed 15 years ago
Copying an empty string to a new string causes it to allocate a buffer
Categories
(Core :: XPCOM, defect)
Core
XPCOM
Tracking
()
RESOLVED
FIXED
Tracking | Status | |
---|---|---|
status1.9.2 | --- | beta1-fixed |
People
(Reporter: neil, Assigned: neil)
Details
(Keywords: perf)
Attachments
(1 file, 2 obsolete files)
2.43 KB,
patch
|
jst
:
superreview+
benjamin
:
approval1.9.2+
|
Details | Diff | Splinter Review |
Steps to reproduce problem: 1. nsCString a, b; 2. a = b; Expected result: nothing happens Actual results: a now has a sharable buffer
Assignee | ||
Comment 1•15 years ago
|
||
As well as failing, if you compile with string stats you would notice that the new test consumes an extra string buffer without the empty copy optimisation. I'm not sure that the test correctly tests for a new string buffer creation. I also fixed an inconsistent memory allocation since I build with them fatal.
Assignee: nobody → neil
Status: NEW → ASSIGNED
Attachment #383805 -
Flags: superreview?(dbaron)
Attachment #383805 -
Flags: review?(dbaron)
Assignee | ||
Comment 2•15 years ago
|
||
Sorry, I forgot to check what I was diffing...
Attachment #383805 -
Attachment is obsolete: true
Attachment #384139 -
Flags: superreview?(dbaron)
Attachment #384139 -
Flags: review?(dbaron)
Attachment #383805 -
Flags: superreview?(dbaron)
Attachment #383805 -
Flags: review?(dbaron)
Comment on attachment 384139 [details] [diff] [review] Correct patch I hate the way we implement VOIDED. (I wish it were orthogonal to what was in the buffer.) But anyway... >+ if (str.mFlags & F_VOIDED) >+ { >+ // inherit the F_VOIDED attribute >+ SetIsVoid(PR_TRUE); >+ } >+ else if (!str.mLength) >+ { >+ Truncate(); >+ } Isn't it true that F_VOIDED should only be set when mLength is zero? Can't we assert that and then combine these two clauses: if (!str.mLength) { if (str.mFlags & F_VOIDED) SetIsVoid(PR_TRUE); else Truncate(); } or perhaps even: if (!str.mLength) { Truncate(); mFlags |= (str.mFlags & F_VOIDED); } r=dbaron, but I'd like jst to sr to make sure that my assumption that it's expected for F_VOIDED to be propagated on assignment is correct (since I suppose right now that only happens some of the time).
Attachment #384139 -
Flags: superreview?(jst)
Attachment #384139 -
Flags: superreview?(dbaron)
Attachment #384139 -
Flags: review?(dbaron)
Attachment #384139 -
Flags: review+
Comment 4•15 years ago
|
||
Comment on attachment 384139 [details] [diff] [review] Correct patch sr=jst. I do think we should propagate the voided flag on assignment consistently.
Attachment #384139 -
Flags: superreview?(jst) → superreview+
Assignee | ||
Comment 5•15 years ago
|
||
We already do, since we never set both F_SHARED and F_VOIDED simultaneously.
Assignee | ||
Comment 6•15 years ago
|
||
Attachment #384139 -
Attachment is obsolete: true
Attachment #390535 -
Flags: superreview?(jst)
Updated•15 years ago
|
Attachment #390535 -
Flags: superreview?(jst) → superreview+
Assignee | ||
Comment 7•15 years ago
|
||
Pushed changeset f319ed9df9d4 to mozilla-central.
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Updated•15 years ago
|
Flags: blocking1.9.2?
Comment 9•15 years ago
|
||
Can we get a mozilla-1.9.2 patch nominated for approval, please?
Flags: wanted1.9.2+
Flags: blocking1.9.2?
Flags: blocking1.9.2-
Updated•15 years ago
|
Attachment #390535 -
Flags: approval1.9.2+
Assignee | ||
Comment 10•15 years ago
|
||
Pushed changeset dcc67c2cb0f1 to releases/mozilla-1.9.2
status1.9.2:
--- → beta1-fixed
You need to log in
before you can comment on or make changes to this bug.
Description
•