Allowed memory size of 134217728 bytes out of print (allocation attempt of 42 bytes)


I am retrieving record from mysql table which return more than 0.2m number of rows per query, which obviously take lot of memory. in my case i have 8 GBs installed RAM on my system with SSD 256 GBs. When i execute my page it returns the following error:

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 42 bytes) in D:\xampp\htdocs\classes\CRUD.php on line 84

I think i should need to use threading instead of php loops over table rows? Maybe i am wrong. Any suggestion/help will be appreciated.

Default php.ini memory_limit is 128 MB. You should either:

  • Optimize your code to use a normal amount of data
  • change memory_limit in php.ini to higher value which I do not recommend at all - with your approach you will hit this wall once again