Last Comment Bug 520661 - nsDeque should handle out-of-memory better
: nsDeque should handle out-of-memory better
Product: Core
Classification: Components
Component: XPCOM (show other bugs)
: Trunk
: All All
P2 normal (vote)
: mozilla1.9.3a1
Assigned To: David Baron :dbaron: ⌚️UTC-8
: Nathan Froyd [:froydnj]
Depends on:
  Show dependency treegraph
Reported: 2009-10-05 16:16 PDT by David Baron :dbaron: ⌚️UTC-8
Modified: 2009-10-30 15:08 PDT (History)
3 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

patch (3.49 KB, patch)
2009-10-05 16:16 PDT, David Baron :dbaron: ⌚️UTC-8
benjamin: review+
benjamin: approval1.9.2+
dveditz: approval1.9.1.6+
Details | Diff | Splinter Review

Description User image David Baron :dbaron: ⌚️UTC-8 2009-10-05 16:16:15 PDT
Created attachment 404717 [details] [diff] [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.
Comment 1 User image David Baron :dbaron: ⌚️UTC-8 2009-10-07 20:43:34 PDT
Comment 2 User image David Baron :dbaron: ⌚️UTC-8 2009-10-07 20:44:36 PDT
Comment on attachment 404717 [details] [diff] [review]

Want to get this in on the chance that it's responsible for some of the cycle collector crashes.
Comment 3 User image David Baron :dbaron: ⌚️UTC-8 2009-10-08 11:55:25 PDT
Comment 4 User image Daniel Veditz [:dveditz] 2009-10-30 12:19:12 PDT
Comment on attachment 404717 [details] [diff] [review]

>  * @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, a=dveditz for release-drivers
Comment 6 User image David Baron :dbaron: ⌚️UTC-8 2009-10-30 15:08:06 PDT
(with comment fix rolled in)

Note You need to log in before you can comment on or make changes to this bug.