it's hard to tell where the problem is comming from, it could be the memory limit.
if you open the file config.php and replace the line
$gallery->setDebug(false);
with
$gallery->setDebug('buffered');
and then go again to the maintenance task and start it, you should see the memory usage in the upper right corner.
if this is the problem, you should just increase the memory limit to something like
php_value memory_limit 24M
or 32 or 64 during the build thumbs/resizes task.