Closed Bug 424677 Opened 17 years ago Closed 17 years ago

nsImapProtocol.cpp leaks nsVoidArray (4 bytes) due to static declaration

Categories

(MailNews Core :: Backend, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: standard8, Assigned: standard8)

References

Details

(Keywords: memory-leak)

Attachments

(1 file)

I was seeing if there were any mailnews-specific instances of bug 362318, and came across this: http://bonsai.mozilla.org/cvsblame.cgi?file=/mozilla/mailnews/imap/src/nsImapProtocol.cpp&rev=1.676&mark=321#305 Its an nsVoidArray-derived static that "leaks" 4 bytes, the same amount as on the SeaMonkey trunk tinderbox... Its used in one place here: http://bonsai.mozilla.org/cvsblame.cgi?file=/mozilla/mailnews/imap/src/nsImapProtocol.cpp&rev=1.676&mark=3014-3021#2998 Not quite sure of the best solution here - should we take the hit and parse custom headers each time? or could we just parse it for each nsImapProtocol instance?
Keywords: mlk
(In reply to comment #0) >Not quite sure of the best solution here - should we take the hit and parse >custom headers each time? or could we just parse it for each nsImapProtocol >instance? I think it would be good to parse it each time; it means the pref is live.
Attached patch Possible FixSplinter Review
I took a look at the code in a bit more detail. As I'm not sure how often the main function is called, I went for defining the array on a per-class basis and initialising it in the constructor. This definitely stops the leak.
Assignee: nobody → bugzilla
Status: NEW → ASSIGNED
Attachment #311879 - Flags: superreview?(neil)
Attachment #311879 - Flags: review?(neil)
Comment on attachment 311879 [details] [diff] [review] Possible Fix >+ aPrefBranch->GetBoolPref("mail.imap.hide_other_users", > &gHideOtherUsersFromList); You'll want to reindent the continuation lines (& lines up with the ").
Attachment #311879 - Flags: superreview?(neil)
Attachment #311879 - Flags: superreview+
Attachment #311879 - Flags: review?(neil)
Attachment #311879 - Flags: review+
(In reply to comment #3) > (From update of attachment 311879 [details] [diff] [review]) > >+ aPrefBranch->GetBoolPref("mail.imap.hide_other_users", > > &gHideOtherUsersFromList); > You'll want to reindent the continuation lines (& lines up with the "). > Patch checked in with lines corrected. This solves the final 4 byte leak on SeaMonkey's tinderbox :-)
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Blocks: 426963
Product: Core → MailNews Core
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: