Closed
Bug 578357
Opened 15 years ago
Closed 15 years ago
Use fallible allocation for image frames
Categories
(Core :: Graphics: ImageLib, defect)
Core
Graphics: ImageLib
Tracking
()
RESOLVED
FIXED
| Tracking | Status | |
|---|---|---|
| blocking2.0 | --- | final+ |
People
(Reporter: bholley, Assigned: bholley)
Details
Attachments
(1 file)
|
1.75 KB,
patch
|
joe
:
review+
cjones
:
review+
|
Details | Diff | Splinter Review |
Now that we're using infallible malloc, we should switch image frames to fallible allocation, since it's pretty trivial to cause the allocation of a huge frame with a very small compressed image file.
Updated•15 years ago
|
blocking2.0: --- → ?
Updated•15 years ago
|
blocking2.0: ? → final+
Updated•15 years ago
|
Assignee: nobody → bobbyholley+bmo
| Assignee | ||
Comment 1•15 years ago
|
||
Working up a patch for this - A lot of the relevant allocations here end up happening in cairo, which should probably be using a globally fallible allocator.
cjones - can you confirm whether cairo uses fallible malloc by default? If not, I think it probably should.
Status: NEW → ASSIGNED
| Assignee | ||
Comment 2•15 years ago
|
||
Attached a patch to do fallible allocation for image surfaces in imagelib and thebes. Note that the low-memory checking we do in imgFrame.cpp is a no-op everywhere but windows and maemo, so fallible allocation is still very important there. Please speak up if there's another spot I missed.
| Assignee | ||
Comment 3•15 years ago
|
||
Comment on attachment 468232 [details] [diff] [review]
patch - v1
Flagging joe and cjones for review.
Joe, are you an unofficial thebes peer? The only people listed on despot are vlad stuart and roc, and I'm guessing they're all on the busy side. Then again, vlad might like to look at it anyway...
Attachment #468232 -
Flags: review?(jones.chris.g)
Attachment #468232 -
Flags: review?(joe)
Comment 4•15 years ago
|
||
Comment on attachment 468232 [details] [diff] [review]
patch - v1
Yeah, I'm an unofficial gfx peer.
Attachment #468232 -
Flags: review?(joe) → review+
Comment on attachment 468232 [details] [diff] [review]
patch - v1
Looks OK to me, except for the C-style casts, but your gfx peer has already ruled on those ;).
Attachment #468232 -
Flags: review?(jones.chris.g) → review+
Sorry, missed this.
(In reply to comment #1)
> Working up a patch for this - A lot of the relevant allocations here end up
> happening in cairo, which should probably be using a globally fallible
> allocator.
>
> cjones - can you confirm whether cairo uses fallible malloc by default? If not,
> I think it probably should.
If it's using bare malloc/calloc/realloc, then yes, that's fallible. I don't know the cairo code, though.
(In reply to comment #6)
> Sorry, missed this.
>
> (In reply to comment #1)
> > Working up a patch for this - A lot of the relevant allocations here end up
> > happening in cairo, which should probably be using a globally fallible
> > allocator.
> >
> > cjones - can you confirm whether cairo uses fallible malloc by default? If not,
> > I think it probably should.
>
> If it's using bare malloc/calloc/realloc, then yes, that's fallible.
It's fallible and unaffected by mozalloc, I should add.
Comment 8•15 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Version: unspecified → Trunk
Comment 9•15 years ago
|
||
Comment on attachment 468232 [details] [diff] [review]
patch - v1
>- mPalettedImageData = (PRUint8*)PR_MALLOC(PaletteDataLength() + GetImageDataLength());
>+ // Use the fallible allocator here
>+ mPalettedImageData = (PRUint8*)moz_malloc(PaletteDataLength() + GetImageDataLength());
Nit: should switch the deallocator from PR_FREEIF to free too.
You need to log in
before you can comment on or make changes to this bug.
Description
•