0

Does anyone have idea why is memory going up for every request when I'm using Http facade with Laravel Octane ?

Route::get('test', function () {
Http::get('https://swapi.dev/api/people/1');

return memory_get_usage();
});

enter image description here

But when I use Guzzle client like this it's not leaking

Route::get('test', function () {
    $client = new \GuzzleHttp\Client();
    $client->get('https://swapi.dev/api/people/1');
    return memory_get_usage();
});

enter image description here

Osta
  • 147
  • 5

3 Answers3

0

class object is not being garbage collected I think.Because its being used somewhere. unset it after you are done with it.

It should free the memory used.

Amir Daneshkar
  • 771
  • 3
  • 9
  • If that is true I should post this issue on Octane's repository. Also I'm not sure how can I unset this `Http::get('https://swapi.dev/api/people/1');` If I save results and then unset variable it does not make any difference – Osta Feb 17 '22 at 11:01
0

this is actually a bug in the Laravel HTTP facade because I had encountered the same problem in another context.

0

This is the response I've got from official Laravel team member.

https://github.com/laravel/octane/issues/481

The point is that this is not a bug and that it is happening because the garbage collector has not done his thing yet.

Osta
  • 147
  • 5