Closed Bug 551279 Opened 14 years ago Closed 14 years ago

Mismatched allocators (operator new[] and free) in gfxTextRun

Categories

(Core :: Graphics, defect)

x86
macOS
defect
Not set
normal

Tracking

()

VERIFIED DUPLICATE of bug 550805

People

(Reporter: jruderman, Unassigned)

References

Details

(Keywords: valgrind)

Attachments

(1 file)

I don't completely understand this valgrind complaint.  Is it due to the recent Gecko-wide allocator changes?

(Not attaching a testcase, but I think one of the testcases in bug 499862 triggers this code.)
Attached file valgrind complaint
I think this is a regression from bug 545989.
Depends on: 545989
The patch in bug 545989 was sound, AFAICS... it removes custom allocation (and the custom delete operator) from the gfxTextRun, and the factory Create() method now just uses operator new to create it. And for the auxiliary storage (mCharacterGlyphs array), it uses correctly-paired new (std::nothrow) [] and delete[].

However, looking at memory/mozalloc/mozalloc.h, I notice that it does not appear to redefine the (std::nothrow) variants of operator new / new[]. I think that's probably the root of the problem - and it will also apply to other callsites where we've used new (std::nothrow). There aren't many, but mxr finds a few examples in WebGL and Canvas as well as font code; and also some custom allocators in wince code that may need to be checked.
Mind fixing all those std::nothrows? :-)
(In reply to comment #3)
> However, looking at memory/mozalloc/mozalloc.h, I notice that it does not
> appear to redefine the (std::nothrow) variants of operator new / new[]. I think
> that's probably the root of the problem - and it will also apply to other
> callsites where we've used new (std::nothrow). There aren't many, but mxr finds
> a few examples in WebGL and Canvas as well as font code; and also some custom
> allocators in wince code that may need to be checked.

Yeah, this was my fault.  There's a patch floating around that adds (fallible) ::operator new(nothrow) to mozalloc, should land soon I hope.
This is really a dup of bug 550805, just reported in a different form.

(TBH, I don't actually understand why we're inventing mozilla::fallible instead of just using std::nothrow. Seems like that would be the standard C++ idiom for this functionality.)
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → DUPLICATE
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: