File tree Expand file tree Collapse file tree 3 files changed +7
-25
lines changed
Expand file tree Collapse file tree 3 files changed +7
-25
lines changed Original file line number Diff line number Diff line change @@ -13,20 +13,14 @@ if (getenv("SKIP_SLOW_TESTS")) {
1313
1414$ JS = <<< EOT
1515var jsfunc = function() {
16- var text = "abcdefghijklmnopqrstuvwyxz0123456789";
17- var memory = "";
18- for (var i = 0; i < 100; ++i) {
19- for (var j = 0; j < 10000; ++j) {
20- memory += text;
21- }
22- sleep(0);
23- }
16+ // Allocate a single large string to deterministically exceed the limit
17+ var memory = new Array(12 * 1024 * 1024).join("x"); // ~12 MB
2418};
2519jsfunc;
2620EOT ;
2721
2822$ v8 = new V8Js ();
29- $ v8 ->setMemoryLimit (10000000 );
23+ $ v8 ->setMemoryLimit (10_000_000 );
3024
3125$ func = $ v8 ->executeString ($ JS );
3226var_dump ($ func );
Original file line number Diff line number Diff line change @@ -14,14 +14,8 @@ if (getenv("SKIP_SLOW_TESTS")) {
1414$ JS = <<< EOT
1515var jsfunc = function() {
1616 PHP.imposeMemoryLimit();
17- var text = "abcdefghijklmnopqrstuvwyxz0123456789";
18- var memory = "";
19- for (var i = 0; i < 100; ++i) {
20- for (var j = 0; j < 10000; ++j) {
21- memory += text;
22- }
23- sleep(0);
24- }
17+ // Allocate a single large string to deterministically exceed the limit
18+ var memory = new Array(12 * 1024 * 1024).join("x"); // ~12 MB
2519};
2620jsfunc;
2721EOT ;
Original file line number Diff line number Diff line change @@ -11,14 +11,8 @@ if (getenv("SKIP_SLOW_TESTS")) {
1111--FILE--
1212<?php
1313$ JS = <<< EOT
14- var text = "abcdefghijklmnopqrstuvwyxz0123456789";
15- var memory = "";
16- for (var i = 0; i < 100; ++i) {
17- for (var j = 0; j < 10000; ++j) {
18- memory += text;
19- }
20- sleep(0);
21- }
14+ // Allocate a single large string to deterministically exceed the limit
15+ var memory = new Array(12 * 1024 * 1024).join("x"); // ~12 MB
2216EOT ;
2317
2418$ v8 = new V8Js ();
You can’t perform that action at this time.
0 commit comments