andreascreten/wp-cli — Issue #73: Memory limit problem
Author: redcuillin
Created: 2012-02-23 04:03:30+00:00
State: open

I'd really like to use wp-cli, but I'm running into a problem with a hard memory limit on an Ubuntu box.

On running wp I get error:
````PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 30720 bytes) in /path/to/wordpress/wp-admin/
includes/post.php on line 635
PHP Stack trace:
PHP 1. {main}() /path/to/git/wp-cli/src/php/wp-cli/wp-cli.php:0
PHP 2. require_once() /path/to/git/wp-cli/src/php/wp-cli/wp-cli.php:91````

The problem is not resolved by editing php.ini and increasing the memory limit, because of an issue described here:
http://stackoverflow.com/questions/3318636/how-else-might-a-php-cli-script-determine-its-memory-limit

In summary, Linux on 32bit and 64bit (I have 64 bit) machines seems to have a heap limit, which makes the max memory allocation for PHP CLI 4MB/8MB, regardless of what you set in php.ini. (The 'unlimited' option is actually 4MB, and if you set it to 5MB in php.ini it actually goes down in reality to 1MB!)

This kind of memory stuff is way outside my comfort zone - but I wonder if there's a way to do something in the code to free up some memory?