Closed
Bug 943505
Opened 11 years ago
Closed 11 years ago
Use fallible allocation in nsZipItemPtr_base::nsZipItemPtr_base
Categories
(Core :: XPCOM, defect)
Tracking
()
RESOLVED
FIXED
mozilla29
People
(Reporter: benjamin, Assigned: lpy)
References
(Blocks 1 open bug)
Details
(Whiteboard: [mentor=benjamin@smedbergs.us][lang=c++])
Attachments
(1 file, 4 obsolete files)
878 bytes,
patch
|
benjamin
:
review+
|
Details | Diff | Splinter Review |
One of the top OOM crashers is the infallible alloc at http://hg.mozilla.org/releases/mozilla-release/annotate/d20d499b219f/modules/libjar/nsZipArchive.cpp#l1126 which is often 500k. See https://crash-stats.mozilla.com/report/index/d47de7ff-63cd-4f02-a649-d44c42131122 for an example. This may require punting some error checking up into callers, since this is a constructor.
Comment 1•11 years ago
|
||
(In reply to Benjamin Smedberg [:bsmedberg] from comment #0) > One of the top OOM crashers is the infallible alloc at > http://hg.mozilla.org/releases/mozilla-release/annotate/d20d499b219f/modules/ > libjar/nsZipArchive.cpp#l1126 which is often 500k. See > https://crash-stats.mozilla.com/report/index/d47de7ff-63cd-4f02-a649- > d44c42131122 for an example. > > This may require punting some error checking up into callers, since this is > a constructor. Hi Benjamin: I am interested in fixing this bug, are you available for mentoring?
Assignee | ||
Comment 2•11 years ago
|
||
use fallible allocation moz_malloc
Assignee: nobody → pylaurent1314
Attachment #8344511 -
Flags: review?(benjamin)
Reporter | ||
Comment 3•11 years ago
|
||
Comment on attachment 8344511 [details] [diff] [review] bug943505.patch mAutoBuf is a nsAutoArrayPtr, which means that it is going to be cleaned up with operator delete[], which potentially isn't the same allocator with moz_malloc. This should instead be using the fallible version of operator new[], which would be I think: mAutoBuf = new (fallible_t()) uint8_t[size];
Attachment #8344511 -
Flags: review?(benjamin) → review-
Assignee | ||
Comment 4•11 years ago
|
||
Thank you. I update the patch.
Attachment #8344511 -
Attachment is obsolete: true
Attachment #8344672 -
Flags: review?(benjamin)
Assignee | ||
Comment 5•11 years ago
|
||
Oh, a small mistake, update again :)
Attachment #8344672 -
Attachment is obsolete: true
Attachment #8344672 -
Flags: review?(benjamin)
Attachment #8344679 -
Flags: review?(benjamin)
Reporter | ||
Comment 6•11 years ago
|
||
Why did version 2 not work? I'd prefer the single-line version if possible.
Reporter | ||
Comment 7•11 years ago
|
||
Comment on attachment 8344679 [details] [diff] [review] bug943505-V3.patch I'm going to mark r- on this because I prefer version 2. You can have an r+ on that version, or feel free to re-request review on this version if there's a reason it has to be this way.
Attachment #8344679 -
Flags: review?(benjamin) → review-
Assignee | ||
Comment 8•11 years ago
|
||
Thanks :) Patch update again. the version 2 is compiled error. Now this patch is good.
Attachment #8344679 -
Attachment is obsolete: true
Attachment #8345660 -
Flags: review?(benjamin)
Reporter | ||
Comment 9•11 years ago
|
||
Comment on attachment 8345660 [details] [diff] [review] bug943505-Final.patch I will not ask why the extra set of parens was necessary ;-)
Attachment #8345660 -
Flags: review?(benjamin) → review+
Reporter | ||
Comment 10•11 years ago
|
||
Comment on attachment 8345660 [details] [diff] [review] bug943505-Final.patch Actually though, this uses the fallible allocator but doesn't null-check. Don't you need to early-return if the allocation failed?
Attachment #8345660 -
Flags: review+ → review-
Assignee | ||
Comment 11•11 years ago
|
||
Thanks!
Attachment #8345660 -
Attachment is obsolete: true
Attachment #8345914 -
Flags: review?(benjamin)
Reporter | ||
Comment 12•11 years ago
|
||
Comment on attachment 8345914 [details] [diff] [review] bug943505-Final-V2.patch I had to verify that this would actually propagate, but http://hg.mozilla.org/mozilla-central/annotate/12ea03a70243/modules/libjar/nsZipArchive.cpp#l232 is the error checking which makes this correct. Thank you!
Attachment #8345914 -
Flags: review?(benjamin) → review+
Reporter | ||
Updated•11 years ago
|
Keywords: checkin-needed
Comment 13•11 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/5ac5cccfd354
Keywords: checkin-needed
Comment 14•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/5ac5cccfd354
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla29
You need to log in
before you can comment on or make changes to this bug.
Description
•