4 ms·
Setting a 1gb memory limit is a great way to hide the problem and dramatically reduce the maximum number of concurrent requests to your website, and drain resou
by martin_ 12y ago
Setting a 1gb memory limit is a great way to hide the problem and dramatically reduce the maximum number of concurrent requests to your website, and drain resources from any other services running on the box(es).
- 2upmedia 12y agoIncreasing the memory limit is only temporary. It's used as a debugging procedure. I later write "If by increasing the memory limit you have gotten rid of the error and your code now works, you’ll need to take measures to decrease that memory usage" with a list of things to do to decrease memory usage.
- martin_ 12y agoSorry I missed that section. Carry on!
- arenaninja 12y agoUnless you need the limit to be that high. But I agree that it isn't ideal. However, PHP cleans up nicely once the process ends, and manually freeing memory space can slow PHP down. The only exception I would take to this, I believe, are resources. If is_resource($foo) returns true, you should probably free it (looking at you, JpGraph)
- laumars 12y agoBeing massively pedantic for a moment; he didn't set the memory limit to 1GB but instead to 0.9765625GB: <?php ini_set('memory_limit', '1000M'); // or you could use 1G ?> Joking aside, do most people these days just use MB (1000^n) instead of MiB (1024^n) when working with RAM? Is this now the standard way to calculating memory?
- 2upmedia 12y agoGood call. Minor oversight. Just updated that. I think if your NOT a hardcore technologist you probably think of megabytes as as 1000^n. It's really easy to forget too for the rest of us.
- derickr 12y agoÜber-pedantry: It's "you're" and not "your".