Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ask: fatal error allowed memory size in wp-content/object-cache.php #1397

Open
brm-ryd opened this issue Mar 5, 2024 · 4 comments
Open

Ask: fatal error allowed memory size in wp-content/object-cache.php #1397

brm-ryd opened this issue Mar 5, 2024 · 4 comments
Labels
maybe bug Potential bug, to be investigated

Comments

@brm-ryd
Copy link

brm-ryd commented Mar 5, 2024

Hi,

sorry i have an issue when tried to upgrade to latest qtranslate-xt (from 3.12.1 to 3.15.2) with error:

in php7.4:
PHP Fatal error:  Allowed memory size of 268435456 bytes exhausted (tried to allocate 262144 bytes) in /var/www/html/wp-content/object-cache.php on line 193             
Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 262144 bytes) in /var/www/html/wp-content/object-cache.php on line 193                  
PHP Fatal error:  Allowed memory size of 268435456 bytes exhausted (tried to allocate 262144 bytes) in /var/www/html/wp-includes/load.php on line 326                    
Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 262144 bytes) in /var/www/html/wp-includes/load.php on line 326

in php8.1 (increase memory limit to 512M)
PHP Fatal error:  Allowed memory size of 536870912 bytes exhausted (tried to allocate 262144 bytes) in /var/www/html/wp-content/object-cache.php on line 193
Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 262144 bytes) in /var/www/html/wp-content/object-cache.php on line 193

PHP Fatal error:  Allowed memory size of 268435456 bytes exhausted (tried to allocate 262144 bytes) in /var/www/html/wp-content/object-cache.php on line 2558
Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 262144 bytes) in /var/www/html/wp-content/object-cache.php on line 2558 

does my issue similar with this previously issue #1286 and am i need to allocate up to 2GB+ for this as the current server i only get 3GB ram though.

Many thanks & appreciate for any thoughts

@brm-ryd brm-ryd added the maybe bug Potential bug, to be investigated label Mar 5, 2024
@Komarovski
Copy link
Contributor

I'll try to help,
Can you tell what value you have for "php_memory_limit" in your server's php.ini file or if you doesn't have access to this file, check in hosting panel for memory limit.

Check .htaccess file for string "php_value memory_limit" - if you have one, what you have there?

Also check wp-config.php file for "WP_MEMORY_LIMIT" and "WP_MAX_MEMORY_LIMIT". If you have this constants - what values you have there?

If you have one website on server, I recommend increase memory limit to the max.
For example if you have 3GB of RAM I recommend to set "php_memory_limit" value in php.ini or in hosting panel to 3072M.
If in .htaccess file you have string "php_value memory_limit" set value to 3072M.
If in wp-config.php file you have defined "WP_MEMORY_LIMIT" and "WP_MAX_MEMORY_LIMIT". For "WP_MEMORY_LIMIT" set value to 1024M and for "WP_MAX_MEMORY_LIMIT" set value to 3072M.

If you're using OPcache - I recommend to set available memory for OPcache to use in range of 96-128 MB.
If you're using Redis object cache - I recommend to set available memory for Redis to use between 30-35% of all available memory. In case you have 3GB RAM for Redis cache set available memory value to 1024M.
If you're using Memcache object cache - I recommend to set available memory for Memcache to use 1024M | 2048M.

@brm-ryd
Copy link
Author

brm-ryd commented Mar 5, 2024

Thank you @Komarovski ,
AFAIK, the memory_limit only set in php.ini which tried to set 256M & 512M, for wp-config.php & .htaccess there should be exist any memory_limit or anything.

Redis object cache is exist do you think testing for disable the plugin to check for redis config i believe the memory is also around 256M & 512M.

@Komarovski
Copy link
Contributor

The memory_limit with 256M or 512M for WordPress is too low, especially if you have a lot of plugins, custom queries, not optimized theme, etc. If your hosting plan gives you 3GB of RAM, then set in php.ini memory_limit to 3072M. This way PHP will have enough of RAM if it will need to process some heavy script.

In this log:

in php8.1 (increase memory limit to 512M)
PHP Fatal error:  Allowed memory size of 536870912 bytes exhausted (tried to allocate 262144 bytes)...

PHP is telling you that you have allowed memory of 536870912 bytes (approx. 536 MB).
And "tried to allocate 262144 bytes" telling that your script need approx. 262 KB more of RAM to process the script.

As for Redis, if you already have set in php.ini memory_limit to 3072M, then in Redis configuration file I recommend to set maxmemory 1gb - this will be optimal.

@valerensi
Copy link

Hello,
I also have the same problem both with version 3.15.1 and 3.15.2
Fatal error: Allowed memory size of 805306368 bytes exhausted (tried to allocate 16777224 bytes)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maybe bug Potential bug, to be investigated
Projects
None yet
Development

No branches or pull requests

3 participants