The default bug view has changed. See this FAQ.

Only error once on OOM in NewCompartment

RESOLVED FIXED

Status

()

Core
JavaScript Engine
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: Paul Biggar, Unassigned)

Tracking

(Blocks: 1 bug)

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [fixed-in-tracemonkey])

Attachments

(2 attachments)

(Reporter)

Description

6 years ago
Created attachment 536079 [details] [diff] [review]
fix

We shouldn't be calling js_reportOutOfMemory error more than once. JSCompartment::init() does, and then NewCompartment does too. This removes the partial redundancy.
Attachment #536079 - Flags: review?(igor)

Comment 1

6 years ago
Comment on attachment 536079 [details] [diff] [review]
fix

Review of attachment 536079 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/src/jsgc.cpp
@@ +2936,5 @@
>          AutoLockGC lock(rt);
>          if (rt->compartments.append(compartment))
>              return compartment;
> +        else
> +            JS_ReportOutOfMemory(cx);

1. Memory reporting must be done outside any lock.

2. Use js_ReportOutOfMemory.

3. No else after return
Attachment #536079 - Flags: review?(igor) → review-
(Reporter)

Comment 2

6 years ago
Created attachment 536108 [details] [diff] [review]
with error reporting outseide lock
Attachment #536108 - Flags: review?(igor)

Comment 3

6 years ago
Comment on attachment 536108 [details] [diff] [review]
with error reporting outseide lock

Review of attachment 536108 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/src/jsgc.cpp
@@ +2933,5 @@
>  
>          compartment->setGCLastBytes(8192);
>  
> +        {
> +            AutoLockGC lock(rt);

Comment that the extra block is for lock-less error reporting.
Attachment #536108 - Flags: review?(igor) → review+
(Reporter)

Comment 4

6 years ago
http://hg.mozilla.org/tracemonkey/rev/d6987081e730
Whiteboard: [fixed-in-tracemonkey]
(Reporter)

Comment 5

6 years ago
cdleary-bot missed this.
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.