Closed Bug 1266639 Opened 8 years ago Closed 8 years ago

Don't separately heap-allocate PLDHashTables within XPCMaps

Categories

(Core :: XPConnect, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla49
Tracking Status
firefox49 --- fixed

People

(Reporter: n.nethercote, Assigned: n.nethercote)

Details

(Whiteboard: btpp-active)

Attachments

(1 file)

I was looking at a crash report involving XPCMaps (https://crash-stats.mozilla.com/report/index/10b7f3fb-224a-4862-b0e5-c802a2160421) which made me ask "can ClassInfo2WrappedNativeProtoMap:mTable be null?" and I realized it couldn't because that member is infallibly initialized in the constructor and only deleted in the destructor. Which means it doesn't need to be heap-allocated, it can just be an inline member. And the same is true for all the PLDHashTables in the other XPCMaps.
Most of the XPCMap classes contain a |PLDHashTable*|. This can be changed to a |PLDHashTable|, which avoids some malloc/free calls, removes the needs for explicit destructors, and removes "can this pointer be null?" questions. The patch also cleans up the iterators provided by XPCMap classes a little.
Attachment #8744160 - Flags: review?(mrbkap)
Whiteboard: btpp-active
Attachment #8744160 - Flags: review?(mrbkap) → review+
https://hg.mozilla.org/integration/mozilla-inbound/rev/048c047097a97068fa5e4f2592c53e59449ab8fd Bug 1266639 - Don't separately heap-allocate PLDHashTables within XPCMaps. r=mrbkap.
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla48
Target Milestone: mozilla48 → mozilla49
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: