File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change 24
24
#include < mutex>
25
25
#elif !defined(SW_USE_ASM_CONTEXT)
26
26
#define USE_UCONTEXT 1
27
+ #ifndef _XOPEN_SOURCE
27
28
#define _XOPEN_SOURCE
29
+ #endif
28
30
#include < ucontext.h>
29
31
#else
30
32
#define USE_ASM_CONTEXT 1
Original file line number Diff line number Diff line change @@ -22,23 +22,26 @@ $data = [
22
22
];
23
23
$ table ->set ('test ' , $ data );
24
24
25
- ( new Process (function () use ($ table ) {
26
- $ str = str_repeat ('A ' , 4 * 1024 * 1024 );
25
+ $ proc = new Process (function () use ($ table ) {
26
+ $ str = str_repeat ('A ' , 5 * 1024 * 1024 );
27
27
// Fatal error: memory exhausted
28
28
$ data = $ table ->get ('test ' );
29
29
var_dump (strlen ($ data ['string ' ]));
30
30
var_dump (strlen ($ str ));
31
31
var_dump (memory_get_usage ());
32
- }))-> start ( );
32
+ }, true , SOCK_STREAM );
33
33
34
- Process::wait ();
34
+ $ proc ->start ();
35
+
36
+ $ exit_status = Process::wait ();
37
+ Assert::eq ($ exit_status ['code ' ], 255 );
38
+ Assert::contains ($ proc ->read (), 'Fatal error: Allowed memory ' );
35
39
36
40
$ data = $ table ->get ('test ' );
37
41
Assert::eq (strlen ($ data ['string ' ]), $ str_size );
38
42
Assert::eq ($ data ['string ' ], $ str_value );
39
43
echo "Done \n" ;
40
44
?>
41
45
--EXPECTF--
42
- Fatal error: Allowed memory size of %d bytes exhausted at %s (tried to allocate %d bytes) in %s on line %d
43
46
[%s] WARNING lock: lock process[%d] not exists, force unlock
44
47
Done
You can’t perform that action at this time.
0 commit comments