Welcome Guest, Not a member yet? Register   Sign In
Allow memory size exhausted problem!
#1

(This post was last modified: 09-27-2017, 10:53 AM by ciadvantage.)

Hi all

I have this dump message in apache error log as:

PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 85 bytes) in /var/www/mysite.com/system/database/drivers/mysqli/mysqli_result.php on line 183


And this seems to happen only in CI 3.1.5.  , i have tried to increase it up to 1G and it doesnt fix the problem

Please help if you have been through this .

Thanks
Reply
#2

You should be reducing memory usage, not raising the limits. Even 100mb is a lot.

Just don't fetch thousands of DB records at a time.
Reply
#3

Thanks for advice Narf, however my app is complex in the way that one call for a view form, it gathers info from many different tables then serving back to the form. The weird thing is in CI 2.2.x it never has this memory problem and the joined query is based on a certain param so it is single array return. I just dont understand why it caused this issue

Regards
Reply
#4

It sounds like one of two things, your code is at fault or your hosting environment is at fault IMHO. CI does not have overheads anywhere near these massive demands your app seems to be placing. Can you narrow down what it is that is actually causing this huge server demand?
Reply
#5

I extracted that from error log and it refers by one url that involves action as I described. Anyway I guess I need to dig further
to see what really happen. Some recommends to use ini_set('memory_limit',somevalue) at beginnig the function that causes memory exhausts. And I may just try as well to see if it fixes

Thanks anyway
Reply
#6

10 to 1 it's like @Narf said your doing to many database results at once,
this is why there is pagination. You should only get a few records at a time.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#7

(This post was last modified: 09-28-2017, 02:58 PM by ciadvantage.)

The query is only getting data for only one record where the error happens that is why it is driving me nuts! As I said it is the same func
I used in CI 2.2.x and now it is in CI 3.1.5 and it is causing problem
Reply
#8

(09-28-2017, 02:55 PM)ciadvantage Wrote: The query is only getting data for only one record where the error happens that is why it is driving me nuts! As I said it is the same func
I used in CI 2.2.x and now it is in CI 3.1.5 and it is causing problem

I don't know if you had thought about doing so, but maybe if you showed your code somebody could help.
Reply
#9

(09-28-2017, 02:55 PM)ciadvantage Wrote: The query is only getting data for only one record where the error happens that is why it is driving me nuts!

Yes, the error triggers when the memory limit is exceeded, even if by just a single byte.

The line where it is triggered is just the one that technically causes the total usage to exceed the limit, but there's no way for PHP to give you a better error message. It's not a syntax error where it could tell you where you wrote something wrong ...
Reply
#10

Im positive on the query string I wrote since it is just joined query of many tables and it is proven to work with result without a flaw for 3 three years. I am further investigating, perhaps some pre-actions that cause memory exhausted just before it calls the
query
Reply




Theme © iAndrew 2016 - Forum software by © MyBB