The prior script by "e dot a dot schultz at gmail dot com", have a bug
$memoryLimitMB don't have a value
Add
$memoryLimitMB = 8;
Before
$memoryLimit = 8 * $MB;
And change that line for:
$memoryLimit = $memoryLimitMB * $MB;
--------------
Something similar happens with the script by "JohnBrook at pobox dot com"
$memoryLimit don't have a value
Change:
$memoryLimit = $memoryLimit * $MB;
For:
$memoryLimit = $memoryLimitMB * $MB;