Closed Bug 1350371 Opened 7 years ago Closed 7 years ago

jsapi-test testNewContext complains about leaking JSRuntime

Categories

(Core :: JavaScript Engine, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: jonco, Assigned: jonco)

Details

Attachments

(1 file)

Running this jsapi test gives the following output:

testNewContext
Test new context: started
Test new context: finished with 35 allocations
TEST-PASS | testNewContext | ok
WARNING: YOU ARE LEAKING THE WORLD (at least one JSRuntime and everything alive inside it, that is) AT JS_ShutDown TIME.  FIX THIS!

Passed: ran 1 tests.
The problem is that the live runtime count is updated in JSRuntime::destroyRuntime, but that isn't always called if we fail to initialize a new runtime/context.

The patch moves the count update to the destructor for symmetry with the constructor, adds assertions to make sure we always call destoryRuntime when init has previously been called and updates js::NewContext call destroyRuntime appropriately.
Attachment #8851028 - Flags: review?(jdemooij)
Comment on attachment 8851028 [details] [diff] [review]
bug1350371-jsruntime-leak

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

Nice, thanks!
Attachment #8851028 - Flags: review?(jdemooij) → review+
Pushed by jcoppeard@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/e370a8a25bb1
Call destroyRuntime when initialization fails in js::NewContext r=jandem
https://hg.mozilla.org/mozilla-central/rev/e370a8a25bb1
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: