Closed
Bug 872823
Opened 11 years ago
Closed 11 years ago
Move -A option to a OOMAfterAllocations function
Categories
(Core :: JavaScript Engine, enhancement)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla24
People
(Reporter: gkw, Assigned: sfink)
References
(Blocks 1 open bug)
Details
(Keywords: sec-want)
Attachments
(1 file, 1 obsolete file)
6.82 KB,
patch
|
billm
:
review+
sfink
:
checkin+
|
Details | Diff | Splinter Review |
It will be nice to move the -A option into the shell, probably as a OOMAfterAllocations function or something. This might help the fuzzers. We can still get the original CLI behaviour by running -e "OOMAfterAllocations(<some number>)". (decoder, sfink, Jesse and I were somehow part of this conversation at some point) Improvements to this function are welcome, though. :)
Comment 1•11 years ago
|
||
Another advantage I see is that this could be placed anywhere in the script, making the number less dependent on the total memory usage of the script/startup/etc. When I report a bug with -A then the number is usually only valid a few revisions of m-c then the test doesnt reproduce anymore. That makes it even harder to get these bugs fixed.
Assignee | ||
Comment 2•11 years ago
|
||
The number is interpreted as the number of additional allocations after the oomAfterAllocations() call (well, after the body of the function). In trying it out, I already found an OOM bug in jstypedarray.cpp. :-)
Attachment #750171 -
Flags: review?(wmccloskey)
Comment on attachment 750171 [details] [diff] [review] implement oomAfterAllocations testing function Review of attachment 750171 [details] [diff] [review]: ----------------------------------------------------------------- ::: js/src/builtin/TestingFunctions.cpp @@ +739,5 @@ > + JS_ReportError(cx, "count argument required"); > + return false; > + } > + > + int32_t count = args[0].toInt32(); This should deal with the case where it's not an int32. Otherwise the fuzzers will complain. @@ +745,5 @@ > + JS_ReportError(cx, "count argument must be positive"); > + return false; > + } > + > + OOM_maxAllocations = OOM_counter + count; This should be inside #ifdef DEBUG. Also, you should probably set the return value to something. @@ +939,5 @@ > " to count only things of that kind."), > > + JS_FN_HELP("oomAfterAllocations", OOMAfterAllocations, 1, 0, > +"oomAfterAllocations(count)", > +" After 'count' js_malloc memory allocations, fail the allocation (return NULL)"), The help text should end with a period to be consistent.
Attachment #750171 -
Flags: review?(wmccloskey) → review+
Assignee | ||
Comment 4•11 years ago
|
||
Ugh. I hope you don't mind the re-review request. It looks like I neglected to update my previous patch before uploading, since I had already fixed 2 out of 3 of your issues. I've made a few further updates. I made the whole function DEBUG-only, which is probably the only thing that needs review.
Attachment #751770 -
Flags: review?(wmccloskey)
Assignee | ||
Updated•11 years ago
|
Attachment #750171 -
Attachment is obsolete: true
Comment on attachment 751770 [details] [diff] [review] implement oomAfterAllocations testing function Review of attachment 751770 [details] [diff] [review]: ----------------------------------------------------------------- ::: js/src/builtin/TestingFunctions.cpp @@ +945,5 @@ > +#ifdef DEBUG > + JS_FN_HELP("oomAfterAllocations", OOMAfterAllocations, 1, 0, > +"oomAfterAllocations(count)", > +" After 'count' js_malloc memory allocations, fail every following allocation\n" > +"(return NULL)."), Could you indent this line two spaces (after the opening quote) so it lines up?
Attachment #751770 -
Flags: review?(wmccloskey) → review+
Assignee | ||
Updated•11 years ago
|
Attachment #751770 -
Flags: checkin+
Assignee | ||
Comment 6•11 years ago
|
||
http://hg.mozilla.org/integration/mozilla-inbound/rev/0b4e06782cda
Comment 7•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/0b4e06782cda
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla24
Updated•11 years ago
|
Severity: normal → enhancement
You need to log in
before you can comment on or make changes to this bug.
Description
•