I am using laravel 9 and PHP 8, even if I have 0 queries in a certain page I get 25mb of memory usage, for the other pages that have queries it gets to 26mb for memory usage which is a lot for no data. The solutions I tried are the following:
1- AppServiceProvider I added this Model::preventLazyLoading(!app()->isProduction()); and I got rid off all the n+1 functions.
2- I reduced Image sizes there are even pages without images and it has the same issue.
3- I use pagination to list data.
4- I only call the data I need.
Here are some solutions that I checked before posting:
Reduce memory usage for database objects in Laravel
How to see memory usage in Laravel?
https://omarbarbosa.com/posts/optimization-of-eloquent-queries-to-reduce-memory-usage
and some youtube videos which uses the exact same steps.
Nothing works I don't know what is the problem exactly. Any help would be appreciated I use Debugbar to check the memory usage and queries.