Monitor memory usage with each file processed by FileLoader::executeActions()

Abort early if usage might exceed the PHP memory limit.  Resolves pkp/pkp-lib#245.
Also Clinton, to avoid processing lots of entries that have nothing to do
with your installation, you can try to use the copyAccessLogFileTool, under
tools. It will copy all your apache log files to the stage folder, already
filtering the entries that are related to your installation. So when you
process the files, the execution log will be much smaller. This doesn't fix
the problem, of course, I am just pointing how you can solve this for now.

2014-12-10 21:40 GMT-02:00 Bruno Beghelli <bruno.beghelli@gmail.com>:

> I think that even if we fix all those memory issues, it would make more
> sense to create a local execution log file, and only send to admins the
> link to download it. Cases like you're having now Clinton could be much
> worst, with longer apache log files. What do you think?
>
> 2014-12-10 14:39 GMT-02:00 Clinton Graham <notifications@github.com>:
>
> In classes/task/FileLoader.inc.php
>> <https://github.com/pkp/pkp-lib/pull/250#discussion-diff-21615726>:
>>
>> >  		while($filePath = $this->_claimNextFile()) {
>> > +			// We'll have a substantial memory bump when converting the execution log to a string at the end of this process
>> > +			// Keep track of the largest known log increase to preempt out-of-memory errors
>> > +			$newLogSize = strlen(serialize($this->_executionLog));
>>
>> I'm also seeing points of failure at the String::regexp_replace() lines
>> following
>> https://github.com/pkp/pkp-lib/blob/ojs-dev-2_4/classes/mail/Mail.inc.php#L483
>> .
>>
>> I've set a memory_limit of 20M for testing. In my last test I broke out
>> of processing at 15.1M (after 4 monthly logs), and still hit the 20M memory
>> limit with a serialized execution log size of 1.3M.
>>
>> —
>> Reply to this email directly or view it on GitHub
>> <https://github.com/pkp/pkp-lib/pull/250/files#r21615726>.
>>
>
>