Bug 213389 - Have a memory monitor thread in jsc shell when running tests using --memory-limited
Summary: Have a memory monitor thread in jsc shell when running tests using --memory-l...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Saam Barati
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-06-19 10:39 PDT by Saam Barati
Modified: 2020-06-19 15:14 PDT (History)
16 users (show)

See Also:


Attachments
patch (7.22 KB, patch)
2020-06-19 11:39 PDT, Saam Barati
mark.lam: review+
Details | Formatted Diff | Diff
patch for landing (7.26 KB, patch)
2020-06-19 13:25 PDT, Saam Barati
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Saam Barati 2020-06-19 10:39:21 PDT
...
Comment 1 Saam Barati 2020-06-19 11:39:03 PDT
Created attachment 402299 [details]
patch
Comment 2 Mark Lam 2020-06-19 11:56:29 PDT
Comment on attachment 402299 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=402299&action=review

r=me with fixes.

> Source/JavaScriptCore/ChangeLog:19
> +        Currently, we use this feature when  running JSC stress tests in

extra space between "when  running".

> Source/JavaScriptCore/jsc.cpp:2515
> +    memoryLimit = 0;

This is not strictly needed because memoryLimit is in .bss and initialized to 0 by default.  But it won't hurt.

> Source/JavaScriptCore/jsc.cpp:2531
> +            sleep(Seconds::fromMilliseconds(5));

Did you derive this 5 ms from some empirical test, or did you just pluck it out of the air?  Why not 10 ms or something larger?  Not saying you have to change this.  Just wondering how you arrived at this number.

> Source/JavaScriptCore/jsc.cpp:2535
> +#endif

This belongs after the }.  That should fix the Win builds.
Comment 3 Saam Barati 2020-06-19 13:08:21 PDT
Comment on attachment 402299 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=402299&action=review

>> Source/JavaScriptCore/jsc.cpp:2515
>> +    memoryLimit = 0;
> 
> This is not strictly needed because memoryLimit is in .bss and initialized to 0 by default.  But it won't hurt.

indeed. I always struggle with having the assignment vs not. I'll just remove it so it's understood there is no magic involved here.

>> Source/JavaScriptCore/jsc.cpp:2531
>> +            sleep(Seconds::fromMilliseconds(5));
> 
> Did you derive this 5 ms from some empirical test, or did you just pluck it out of the air?  Why not 10 ms or something larger?  Not saying you have to change this.  Just wondering how you arrived at this number.

no, just picked because it seemed reasonable based on how long tests run for
Comment 4 Saam Barati 2020-06-19 13:19:17 PDT
It's worth stating that I validated this by running on my MBP with "--memory-limited", and the only test failure was wasm multi table, and that's because it uses "$vm.isMemoryLimited()" at runtime, which returns true for iOS only.
Comment 5 Saam Barati 2020-06-19 13:25:38 PDT
Created attachment 402315 [details]
patch for landing
Comment 6 EWS 2020-06-19 15:13:51 PDT
Committed r263290: <https://trac.webkit.org/changeset/263290>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 402315 [details].
Comment 7 Radar WebKit Bug Importer 2020-06-19 15:14:17 PDT
<rdar://problem/64546573>