Jump to content

Allowed memory size of 16777216 bytes exhausted...


cs.punk

Recommended Posts

When resizing images of bigger sizes than 300kb (I'm not sure exactly, but that's the figure I estimate) with my home brewed function (image_resize).

 

I get this error:

Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 2304 bytes) in D:\Web Server\xampplite\htdocs\functions\image_resize.php on line 19

 

Of which line 19 is

$tmp_image = imagecreatefromjpeg ($original_image);

 

Why is it using more than 16MB of RAM? When it seems to be just trying to use less than 2kb?

And how do I increase this limit?

 

"Why is it using more than 16MB of RAM? When it seems to be just trying to use less than 2kb?"

 

This particular aspect of your script is not using more than 16Mb of ram, everything being run by PHP in that instance is using a total of more than 16Mb.

 

"And how do I increase this limit?"

 

The variable is memory_limit in your php.ini

 

If this is a shared server you likely do not have access to adjust this value however you can usually do so via your code as well using this at the top of your page.

 

ini_set("memory_limit","32M");

 

where 32M is the new value for PHP Memory.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.