Allowed memory size of xxxxxx bytes exhausted (tried to allocate xxx bytes)
When trying to run PHP code on your website, you may see an error message which looks like this (the numbers will vary):
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 74 bytes) in /folder/path/to/file
This means that your website code is trying to use too much system memory.
In order to prevent a single page view from using up too much system memory, there is a limit on how much memory a PHP script can consume. At the time of writing, this limit is set to 158 MB. If your code tries to use more memory than that, the system will refuse to provide it and your code will crash with an error like the one above.
To fix this, you can try to reduce the complexity of your code. For example, you can try to remove plugins from your website or switch to a different theme and see if that helps. Unfortunately, there is no way to easily see how much memory each piece of code uses, so it will take some trial and error to figure out what’s using all the memory.
If you need more system memory to execute your code, you can upgrade to premium hosting, where you can set your own PHP memory limits.