Closed Bug 1515475 Opened 5 years ago Closed 5 years ago

JS_SetGCParametersBasedOnAvailableMemory / JSGCConfig has 13 elements, not 14

Categories

(Core :: JavaScript: GC, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla66
Tracking Status
firefox66 --- fixed

People

(Reporter: gabriel.russell, Assigned: jonco)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36

Steps to reproduce:

https://github.com/mozilla/gecko-dev/blob/master/js/src/jsapi.cpp#L1286



Actual results:

static const size_t NumGCConfigs = 14;

is wrong. those JSGCConfig arrays have 13 elements.

JS_SetGCParameter(cx, config[i].key, config[i].value);

executes JS_SetGCParameter for config[13] which doesn't exist

In prior versions the arrays had 14 elements. At some point, one of them was taken out, but the count was not updated.

https://github.com/mozilla/gecko-dev/commit/2d06bc1282227aad9ce5a2c22d3aaeb4418bb37b


Expected results:

static const size_t NumGCConfigs = 13;
Status: UNCONFIRMED → NEW
Component: Untriaged → JavaScript: GC
Ever confirmed: true
Product: Firefox → Core
Refactor JS_SetGCParametersBasedOnAvailableMemory to use C++ ranged for loop which will use array length from the type and remove use of incorrect hardcoded array length.
Assignee: nobody → jcoppeard
Attachment #9034187 - Flags: review?(pbone)
Comment on attachment 9034187 [details] [diff] [review]
bug1515475-gc-configs

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

LGTM.
Attachment #9034187 - Flags: review?(pbone) → review+
Thanks for noticing this Gabriel.
Pushed by jcoppeard@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/da05e40ae372
Remove hardcoded length of config arrays for JS_SetGCParametersBasedOnAvailableMemory a=pbone
https://hg.mozilla.org/mozilla-central/rev/da05e40ae372
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla66
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: