swoole_timer_tick(3, function () {
$memory = 0;
$redis = new \Swoft\Redis\Redis();
$redis->getMultiple('a', 'b');
unset($redis);
echo "\n memory use :" . (memory_get_usage() - $memory);
echo "\t" . $memory = memory_get_usage();
});
运行脚本会发现内存持续增加
memory use :19795272 19795272
++++++++end(array)++++++++++++
memory use :19796720 19796720
++++++++end(array)++++++++++++
memory use :19798168 19798168
++++++++end(array)++++++++++++
memory use :19799616 19799616
++++++++end(array)++++++++++++
memory use :19812344 19812344
++++++++end(array)++++++++++++
memory use :19802512 19802512
++++++++end(array)++++++++++++
memory use :19803960 19803960
++++++++end(array)++++++++++++
memory use :19805408 19805408
++++++++end(array)++++++++++++
memory use :19806856 19806856
++++++++end(array)++++++++++++
中间省略N行
memory use :21215456 21215456
++++++++end(array)++++++++++++
memory use :21205624 21205624
++++++++end(array)++++++++++++
memory use :21218352 21218352
++++++++end(array)++++++++++++
memory use :21208520 21208520
++++++++end(array)++++++++++++
memory use :21221248 21221248
++++++++end(array)++++++++++++
memory use :21211416 21211416
++++++++end(array)++++++++++++
memory use :21212864 21212864
++++++++end(array)++++++++++++
memory use :21214312 21214312
++++++++end(array)++++++++++++
memory use :21215760 21215760
++++++++end(array)++++++++++++
memory use :21217208 21217208
++++++++end(array)++++++++++++
memory use :21218656 21218656
++++++++end(array)++++++++++++
memory use :130834744 130834744
++++++++end(array)++++++++++++
PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /code/test/vendor/swoft/framework/src/Proxy/Proxy.php(44) : eval()'d code on line 17
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /code/test/vendor/swoft/framework/src/Proxy/Proxy.php(44) : eval()'d code on line 17
You have
swoft: 1.0.0, php: 7.2.7, swoole: 4.0.1
运行脚本会发现内存持续增加