Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does PHP memory_limit pre-allocate memory to PHP

Some of the pages on our website a hitting the PHP memory limit, which is currently set to 128MB. When requesting to bump the memory limit to 256MB, we were told by the engineer at our hosting company that:

On our server "the average request requires less than 64MB of RAM"

and

"shifting memory limit to 256MB essentially creates an average allocation of 192M of memory that won't get used on most requests"

Is this correct that the memory_limit amount is actually pre-allocated and is 192MB will be wasted for most of our requests?

Thank you!

like image 491
Invisigoth Avatar asked Dec 10 '22 18:12

Invisigoth


1 Answers

From: http://php.net/manual/en/ini.core.php#ini.memory-limit

This sets the maximum amount of memory in bytes that a script is allowed to allocate. This helps prevent poorly written scripts for eating up all available memory on a server. Note that to have no memory limit, set this directive to -1.

In my experience, many sites require more than 128M.

like image 165
user2182349 Avatar answered Dec 13 '22 09:12

user2182349