user3508178
user3508178

Reputation: 13

PHP Fatal Error: Allow Memory Size

I'm getting this and I'm not sure why?

[21-Feb-2015 01:10:43 UTC] PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 32 bytes) in /home/vcasts/public_html/ajax.php on line 30

Line 30 is..

$users[] = rtrim( fgets( $fp, 32 ) );

Help anyone?

Upvotes: 1

Views: 250

Answers (2)

Totallama
Totallama

Reputation: 448

If it happens just by running code without any changes done recently, it might be due to the fact that you storing too much data in $_SESSION. Try destroy $_SESSION (session_destroy();) to see if it helps and if so fix the code so that $_SESSION stores only data that are necessary or the code deletes them when not needed.

Upvotes: 0

Krease
Krease

Reputation: 16215

The error is telling you "Allowed memory size of 536870912 bytes exhausted" - you ran out of memory. It's not necessarily this line of code that's the problem, but you have one or more memory hogs somewhere in your app using up about 500MB.

This line just happens to be the one that caused you to exceed the limit.

Refer to this reference answer for how to investigate and fix errors like this.

Upvotes: 1

Related Questions