Closed
Bug 872823
Opened 12 years ago
Closed 12 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)
(deleted),
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•12 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•12 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•12 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•12 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•12 years ago
|
Attachment #751770 -
Flags: checkin+
Assignee | ||
Comment 6•12 years ago
|
||
Comment 7•12 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla24
Reporter | ||
Updated•11 years ago
|
Updated•11 years ago
|
Severity: normal → enhancement
You need to log in
before you can comment on or make changes to this bug.
Description
•