In 6.4.2 carts they added in to Admin >> Configuration >> Images a conditional to bypass preloading all of the images - this is probably why it's timing out and exhausting memory. You could increase server ram but it probably won't make much difference with a large number of products / multiple images.
I think only the pro/b2b 642 carts got the loop ... it's pretty simple anyway, you basically want to bypass this block in admin/categories.php:
Code:
$image_file = $manage_image->getFiles('');
$file_list = '<option value=""> -- None -- </option>';
foreach ($image_file[1] as $relative => $fullpath) {
$file_list .= '<option value="' . rawurlencode($relative) . '">' . $relative . '</option>';
}
unset($image_file);
Simon