Open dmarkic opened 1 month ago
Hello,
this is a memory leak fix for 0.6.x branch.
removeAllListeners()
executor
LazyConnection
Example script:
<?php // load reactphp-mysql/vendor/autoload.php $loop = \React\EventLoop\Loop::get(); $factory = new \React\MySQL\Factory(); $connection = $factory->createLazyConnection('localhost'); //$connection = \React\Async\await($factory->createConnection('localhost')); $pre_memory = 0; $loop->addPeriodicTimer( 1, function () use ($connection, &$pre_memory) { $connection->query('SELECT \'' . str_repeat('A', 1000) . '\'')->then( function ($res) use (&$pre_memory) { echo " - query done\n"; $cur_memory = memory_get_usage(); $new_memory = $cur_memory - $pre_memory; echo " - Memory usage: " . memory_get_usage() . " new: " . $new_memory . "\n"; $pre_memory = $cur_memory; }, function ($e) { echo " - query error: " . $e->getMessage() . "\n"; throw $e; } ); } ); $loop->run();
Issue #179
Hello,
this is a memory leak fix for 0.6.x branch.
removeAllListeners()
on all commands.executor
when connection closesLazyConnection
opens/closes connection.Example script: