Could possibly be this code
// Count the files with a glob, easier and less time consuming
$num_files = count(glob($dir . '/*.elk'));
EDIT: Tested with 180k files in one dir, down to 7MB memory from 40+MB. In ./sources/subs/ManageAttachments.subs.php, find the above code and replace with
// Count the files with an iterator for a smaller memory footprint.
$num_files = count(new GlobIterator($dir . '/*.elk'));
EDIT2: This is 1.0.