Closed Bug 520661 Opened 15 years ago Closed 15 years ago

nsDeque should handle out-of-memory better

Categories

(Core :: XPCOM, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla1.9.3a1
Tracking Status
status1.9.2 --- beta1-fixed
status1.9.1 --- .6-fixed

People

(Reporter: dbaron, Assigned: dbaron)

Details

Attachments

(1 file)

Attached patch patchSplinter Review
peterv and I noticed this while debugging cycle collector crashes; given that the cycle collector creates nsDeque objects that require multi-megabyte allocations, this could actually affect users sometimes.

(The cycle collector, at least, handles silent failure to add to a deque just fine, in that the worst side effect would be failure to collect objects.)

I also made it use memcpy rather than copying the pointers in an array.
Attachment #404717 - Flags: review?(benjamin)
Attachment #404717 - Flags: review?(benjamin) → review+
http://hg.mozilla.org/mozilla-central/rev/95fb146a7337
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Priority: -- → P2
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.3a1
Comment on attachment 404717 [details] [diff] [review]
patch

Want to get this in on the chance that it's responsible for some of the cycle collector crashes.
Attachment #404717 - Flags: approval1.9.2?
Attachment #404717 - Flags: approval1.9.2? → approval1.9.2+
Comment on attachment 404717 [details] [diff] [review]
patch

>  * @return  capacity of the deque
>  *          If the deque did not grow,
>  *          and you knew its capacity beforehand,
>  *          then this would be a way to indicate the failure.
>  */
>-PRInt32 nsDeque::GrowCapacity() {
>+PRBool nsDeque::GrowCapacity() {

Could you fix up the comment to match the new return value? Thanks

Approved for 1.9.1.5, a=dveditz for release-drivers
Attachment #404717 - Flags: approval1.9.1.5? → approval1.9.1.5+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: