cs.punk Posted July 4, 2009 Share Posted July 4, 2009 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? Quote Link to comment https://forums.phpfreaks.com/topic/164753-allowed-memory-size-of-16777216-bytes-exhausted/ Share on other sites More sharing options...
Daniel0 Posted July 4, 2009 Share Posted July 4, 2009 Maybe the memory bottleneck is elsewhere in your application. Try to run it through a profiler so you can analyze execution flow of the program. Quote Link to comment https://forums.phpfreaks.com/topic/164753-allowed-memory-size-of-16777216-bytes-exhausted/#findComment-868777 Share on other sites More sharing options...
ldougherty Posted July 4, 2009 Share Posted July 4, 2009 "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. Quote Link to comment https://forums.phpfreaks.com/topic/164753-allowed-memory-size-of-16777216-bytes-exhausted/#findComment-868833 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.