We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Payload will not been destruct from memory when not read body.
while (true) { $url = 'Some short url'; $response = $client->request(new Request($url)); echo $response->getHeader('Location'); }
You can add a static counter on Payload construct and destruct, will find out.
construct
destruct
How is it currently fixed in the own code?
Call $response->getBody()->buffer() or $response->getBody()->close() after read response.
$response->getBody()->buffer()
$response->getBody()->close()
The text was updated successfully, but these errors were encountered:
May be should use WeakReference in some stream resource, to make it can auto destruct.
WeakReference
Sorry, something went wrong.
I can't reproduce this with your script, same for the counters, seems to work well and the body is properly GCed.
<?php declare(strict_types=1); use Amp\Http\Client\HttpClientBuilder; use Amp\Http\Client\HttpException; use Amp\Http\Client\Request; require __DIR__ . '/../.helper/functions.php'; while (true) { try { // Instantiate the HTTP client $client = HttpClientBuilder::buildDefault(); // Make an asynchronous HTTP request $response = $client->request(new Request($argv[1] ?? 'https://httpbin.org/user-agent')); $header = $response->getHeader('Location'); echo memory_get_usage(true) . PHP_EOL; } catch (HttpException $error) { echo $error; } }
Try this, use a single pool instance.
I'm now using php8.1 with ev extension on ubuntu 20.04 amd64.
<?php declare(strict_types=1); use Amp\Http\Client\HttpClientBuilder; use Amp\Http\Client\HttpException; use Amp\Http\Client\Request; require __DIR__ . '/../.helper/functions.php'; // Instantiate the HTTP client $client = HttpClientBuilder::buildDefault(); while (true) { try { // Make an asynchronous HTTP request $response = $client->request(new Request($argv[1] ?? 'https://httpbin.org/user-agent')); $header = $response->getHeader('Location'); echo memory_get_usage(true) . PHP_EOL; } catch (HttpException $error) { echo $error; } }
No branches or pull requests
Payload will not been destruct from memory when not read body.
You can add a static counter on Payload
construct
anddestruct
, will find out.How is it currently fixed in the own code?
Call
$response->getBody()->buffer()
or$response->getBody()->close()
after read response.The text was updated successfully, but these errors were encountered: