Closed
Bug 26622
Opened 25 years ago
Closed 14 years ago
nsAutoString use as member variables should be reviewed
Categories
(Core :: XPCOM, defect)
Core
XPCOM
Tracking
()
RESOLVED
WORKSFORME
People
(Reporter: travis, Unassigned)
References
Details
(Keywords: memory-footprint)
Attachments
(2 files, 3 obsolete files)
(deleted),
text/html
|
Details | |
(deleted),
patch
|
neil
:
review+
Bienvenu
:
superreview+
|
Details | Diff | Splinter Review |
I have noticed that there are a number of places where nsAutoString is used as
the type for a member variable. We need to review these cases and determine if
they are really necessary or if nsString would work fine. In many cases this
could be causing unnecessary object bloat. In cases where it is valid, we
should comment the code to say it was intentional.
Updated•25 years ago
|
Target Milestone: M14
Comment 2•25 years ago
|
||
Moving non-essential, non-beta2 and performance-related bugs to M17.
Target Milestone: M15 → M17
Updated•25 years ago
|
Target Milestone: M17 → M18
Comment 3•25 years ago
|
||
moving to browser product and adding arch keyword
Updated•24 years ago
|
Comment 4•24 years ago
|
||
Reassigning to Rickg since he has a source scanning tool that can spot this
easily.
Assignee: warren → rickg
Comment 7•24 years ago
|
||
Thanks Rick! This makes the task so much easier.
Updated•24 years ago
|
Assignee: warren → thesteve
Target Milestone: M18 → ---
Comment 8•24 years ago
|
||
rickg, could you run the report again on the current trunk?
"what would warren do" (tm) ;-) once the report gets generated?
who is a good owner for this now?
maybe thesteve??
Updated•20 years ago
|
Assignee: thesteve → mikael
Updated•20 years ago
|
Status: NEW → ASSIGNED
Comment 9•20 years ago
|
||
Updated•20 years ago
|
Attachment #172796 -
Flags: superreview?(bienvenu)
Attachment #172796 -
Flags: review?(neil.parkwaycc.co.uk)
Updated•20 years ago
|
Attachment #172796 -
Flags: superreview?(bienvenu) → superreview+
Comment 10•20 years ago
|
||
Comment on attachment 172796 [details] [diff] [review]
mailnews patch
This is better than nothing, although as you're touching it...
>Index: mailnews/compose/src/nsSmtpService.h
>- nsCAutoString mServerKeyList;
>+ nsCString mServerKeyList;
IMHO this is unnecessary, we only have the one service.
>Index: mailnews/base/src/nsMessengerWinIntegration.h
>- nsAutoString mAppName;
>- nsAutoString mEmailPrefix;
>+ nsString mAppName;
I'm undecided about this one as it's only used on XP.
>+ nsString mEmailPrefix;
Some trailing spaces crept in...
>Index: mailnews/mapi/mapihook/src/nsMapiRegistryUtils.h
>- nsCAutoString m_thisApp ;
>- nsAutoString m_brand ;
>- nsAutoString m_vendor ;
>- nsAutoString m_versionNo ;
>+ nsCString m_thisApp ;
Gosh, this string is dreadfully abused (not your fault).
>+ nsString m_brand ;
>+ nsString m_vendor ;
These two would work better as nsXPIDLStrings, to save copying.
>+ nsString m_versionNo ;
This one doesn't seem to be used at all...
Attachment #172796 -
Flags: review?(neil.parkwaycc.co.uk) → review+
Comment 11•19 years ago
|
||
As Mikael is not currently working on Mozilla, I've updated his patch which had (r+ and sr+) with respect to Neil's comments and produced this new one. Requesting reviews again just to make sure I've got it right.
David or Neil, could you check this compiles on windows for me? Thanks.
Attachment #172796 -
Attachment is obsolete: true
Attachment #206922 -
Flags: superreview?(bienvenu)
Attachment #206922 -
Flags: review?(neil.parkwaycc.co.uk)
Comment 12•19 years ago
|
||
Comment on attachment 206922 [details] [diff] [review]
mailnews patch v2
>- void getVarValue(const PRUnichar * varName, nsAutoString & result);
>+ void getVarValue(const PRUnichar * varName, nsString & result);
Actually my idea was to have either a PRUnichar * result or an nsXPIDLString & result either way saving on the temporary value.
Comment 13•19 years ago
|
||
Comment on attachment 206922 [details] [diff] [review]
mailnews patch v2
Ok, I see it clearer now with Neil's new comment. I'll update this soon.
Attachment #206922 -
Attachment is obsolete: true
Attachment #206922 -
Flags: superreview?(bienvenu)
Attachment #206922 -
Flags: review?(neil.parkwaycc.co.uk)
Comment 14•19 years ago
|
||
Revised patch, hopefully understanding Neil's comments correctly ;-)
Neil, can you check this compiles on windows as well please?
Attachment #207849 -
Flags: review?(neil.parkwaycc.co.uk)
Comment 15•19 years ago
|
||
Just spoken with Neil over IRC, hopefully this is what he wants...
Attachment #207849 -
Attachment is obsolete: true
Attachment #207854 -
Flags: review?(neil.parkwaycc.co.uk)
Attachment #207849 -
Flags: review?(neil.parkwaycc.co.uk)
Comment 16•19 years ago
|
||
Comment on attachment 207854 [details] [diff] [review]
mailnews patch v4 (checked in)
>+ nsCString m_thisApp ;
>+ nsXPIDLString m_brand ;
>+ nsXPIDLString m_vendor ;
Any reason for the ^^ extra spaces?
While you're removing them, kill the spaces before ; too.
Attachment #207854 -
Flags: review?(neil.parkwaycc.co.uk) → review+
Comment 17•19 years ago
|
||
Comment on attachment 207854 [details] [diff] [review]
mailnews patch v4 (checked in)
Requesting sr, I'll address Neil's review comments on check in.
Attachment #207854 -
Flags: superreview?(bienvenu)
Comment 18•19 years ago
|
||
Comment on attachment 207854 [details] [diff] [review]
mailnews patch v4 (checked in)
thx, sr=bienvenu
Attachment #207854 -
Flags: superreview?(bienvenu) → superreview+
Comment 19•19 years ago
|
||
Comment on attachment 207854 [details] [diff] [review]
mailnews patch v4 (checked in)
This patch is now checked in. I won't be doing any more on this bug as I was just seeing the mailnews patch through. I'll reassign to default owner as well in a minute seeing that Mikael isn't working on it either.
Attachment #207854 -
Attachment description: mailnews patch v4 → mailnews patch v4 (checked in)
Updated•19 years ago
|
Assignee: mikael → dougt
Status: ASSIGNED → NEW
QA Contact: shaver → xpcom
Updated•16 years ago
|
Blocks: 445570
Component: XPCOM → String
OS: Windows NT → All
Priority: P3 → --
QA Contact: xpcom → string
Hardware: PC → All
Comment 21•14 years ago
|
||
I ran
$ hg locate '*.h' | xargs egrep 'nsC?AutoString\s+\w+\s*;'
and looked through the results. Some classes do store nsC?AutoString's as members, but it doesn't look like any class which is instantiated a substantial number of times does.
Let's close this 11-year-old bug.
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → WORKSFORME
Assignee | ||
Updated•4 years ago
|
Component: String → XPCOM
You need to log in
before you can comment on or make changes to this bug.
Description
•