Allowed memory size of 805306368 bytes exhausted



I get the following error from cron job:
ERROR CoreConsole[2014-06-24 21:15:14] [d5d06] Got invalid response from API request: Response was 'PHP Fatal error: Allowed memory size of 805306368 bytes exhausted (tried to allocate 35 bytes) in /var/www/vhosts/ on line 897 ’

Memory_limit in php.ini is shown as 2048M by calling phpinfo()

Piwik-Version is 2.3.0

Any solution?



Hello Siegbert,

In the file core/CliMulti.php in the private function requestUrls(array $piwikUrls)
try to increase the number of milliseconds
usleep(100000); // 100 * 1000 = 100ms
to let say 2000000.




Hello Christoph,

thanks a lot, it works!

I don’t know why a longer sleep solves a problem with too much used memory, but it works and my archives are up to date now.



Hello Siegbert,

I am glad to have been of help. The error msg is not reflecting the real trouble.

I think this is the right solution to the cron archiving problem.



(Matthieu Aubry) #5

Response was 'PHP Fatal error: Allowed memory size of 805306368 bytes exhausted (tried to allocate 35 bytes)

See: Piwik reports this error and fails: "Fatal error: Allowed memory size of X bytes exhausted (tried to allocate X bytes)". What should I do? - Analytics Platform - Matomo


I’ve been looking forward too early :frowning:

Sometimes it works, sometimes I get the same error again. I’m not sure but I think ist is always when site 6 (the largest site) ist archived. But even these site has only about 250 visitors a day, what is not really much.

As described in the initial posting, phpconfig() shows “memory_limit 2048M”. That should be more than enougth.

edit: I also tried to change the DateTable.php and add “ini_set(“memory_limit”,“2048M”);” at the beginning of the script. After that the message shows this limit. But I don’t think that piwik needs so much memory - or didi it??




is there nobody who can help?

Piwik output from archive.php tells me that there ist enough memory:
INFO CoreConsole[2014-06-29 16:30:07] [95273] memory_limit = 2048M

The error-message differs on how much memory I set up in php.ini and always contains the amount of allowed memory. But even if I set it to a very high value of 2048M (2 GB !) the php-script crashes with “Allowed memory size of [memory_limit from php.ini] bytes exhausted”.

The calculatetd data comes from a site with only about 300 visitors a day. I don’t think that there are more then 2 GB of memory neccassary to calculate these data or will piwik really need so much memory?

If the real trouble is not the amount of memory and not the sleep-interval in requestUrls() as Christoph wrote in the second post, is there any other idea how to solve this problem?


(Matthieu Aubry) #8

@Siegbert did you also change this memory limit in the /etc/php5/cli/php.ini file as well?


What python version are you running?

(Matthieu Aubry) #10

@lesjokolat the python version is not relevant here since Python only is used for log analytics


Yes, I set up the memory_limit in all php.ini-files.

Yesterday I changed it from 2048M and 1024M to 512M an now all works without any error.
The V-Server has a “minimum-RAM” of 2GB and “maximum-RAM” of 8GB.
May be that the setting of 1024M in php.ini was too much…??

I will watch the situation for a few more days but for now it seems to work :slight_smile:




I tried all the options listed above. changing the memory_limit to 1024M and back to 512M and also adjusting the usleep to 4000000. But when i run the archive, I still get the same error. The site that I am archiving has huge data.
Allowed memory size of 805306368 bytes exhausted (tried to allocate 64 bytes) in /piwik/install/home/dir/core/DataTable.php on line 1155
Not sure what else to try … Please help

(Matthieu Aubry) #13

change the memory limit in the php.ini file for the CLI process

if you get eror Allowed memory size of 805306368 bytes exhausted (tried to allocate 64 bytes) then it means your 1024M didn’t work (as the message says 800M)


Hi Matt,

I am seeing this error again and I checked all the php.ini files ( /etc/php.ini and /local/mnt/apache/php/) . the memory limit was set to 2048M but still getting the same message. (Exhausted 800M of allocated memory) . I am not sure where piwik is getting the limit from. do you know if there is some setting on the piwik itself to check ? I even tried to process just a week’s data for a profile as it will have smaller set to process. But its still the same error.

Error: Got invalid response from API request: http://localhost/piwik/index.php?module=API&method=API.get&idSite=112&period=month&date=2015-03-01,2015-03-10&format=php&token_auth=removed&trigger=archivephp. Response was ’ Fatal error: Allowed memory size of 805306368 bytes exhausted (tried to allocate 72 bytes) in /local/mnt/apache/htdocs/piwik/core/DataTable.php on line 1325

please help :frowning:


(Matthieu Aubry) #15

Hi Dilish

your web server PHP memory limit is set to 800M. make sure to restart your web server after changing php.ini


I tried restarting the web server and still see the same error. I changed it back to 128M and also restarted the host but I still get the same error. Even if its set to 128M, it says exhausted allocated 800M memory. do you know if its hard coded in the app some where to use that amount of memory ?

(system) #17

thanks for replay