File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -13,20 +13,21 @@ if (getenv("SKIP_SLOW_TESTS")) {
1313
1414$ JS = <<< EOT
1515var jsfunc = function() {
16- var text = "abcdefghijklmnopqrstuvwyxz0123456789";
16+ var text = "abcdefghijklmnopqrstuvwyxz0123456789"; // 36 bytes fits 277777 times in 10 MB
1717 var memory = "";
18- for (var i = 0; i < 100; ++i) {
19- for (var j = 0; j < 10000; ++j) {
18+
19+ // this should exceed the memory limit as it tries to generate 300_000 * 36 bytes = 10.8 MB
20+ for (var i = 0; i < 30; ++i) {
21+ for (var j = 0; j < 10_000; ++j) {
2022 memory += text;
21- }
22- sleep(0);
23+ }
2324 }
2425};
2526jsfunc;
2627EOT ;
2728
2829$ v8 = new V8Js ();
29- $ v8 ->setMemoryLimit (10000000 );
30+ $ v8 ->setMemoryLimit (10_000_000 );
3031
3132$ func = $ v8 ->executeString ($ JS );
3233var_dump ($ func );
You can’t perform that action at this time.
0 commit comments