You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! When I worked on this test, I have a problem - memory leak.
require __DIR__.'/../vendor/autoload.php';
$conf = require __DIR__ . '/config/apollo.php';
$loop = React\EventLoop\Factory::create();
$factory = new React\Stomp\Factory($loop);
$client = $factory->createClient($conf);
$client
->connect()
->then(function ($client) use ($loop) {
$prevMessageCount = 0;
$messageCount = 0;
$loop->addPeriodicTimer(1, function () use (&$i, $client, &$messageCount) {
for ($i = 0; $i < 3000; $i++) {
$client->send('/queue/migration', 'Hello! This id message number '.$messageCount);
echo "Posted this message: 'Hello! This id message number'.$messageCount.'\n";
$messageCount++;
$kmem = memory_get_usage(true) / 1024;
$mem = memory_get_usage() / 1024;
echo "Request: $i\n";
echo "Memory: $mem KiB\n";
echo "Real Memory: $kmem KiB\n";
}
});
$loop->addPeriodicTimer(1, function () use (&$prevMessageCount, &$messageCount) {
$diff = $messageCount - $prevMessageCount;
echo "Sent this second: $diff\n";
$prevMessageCount = $messageCount;
});
}, function (\Exception $e) {
echo sprintf("Could not connect: %s\n", $e->getMessage());
});
$loop->run();
Testing my client with one listener. Different tests. When you send 100 messages per second, there is no memory leak. When posting more than 500 messages per second memory leaks in an arithmetic progression.
How can fix it?
The text was updated successfully, but these errors were encountered:
Hi! When I worked on this test, I have a problem - memory leak.
Testing my client with one listener. Different tests. When you send 100 messages per second, there is no memory leak. When posting more than 500 messages per second memory leaks in an arithmetic progression.
How can fix it?
The text was updated successfully, but these errors were encountered: