You have a memory limit set of 128M.

My db is 25MB and it fails immediately on a restore until I have 448M or above.

You could increase the memory limit globally or just stick these at the start of the file and experiment uncommenting one at a time to see what you need:

Code:
/** for phpStorm
 * @var queryFactoryResult $db
 * @var messageStack $messageStack
 */
ini_set('memory_limit', '256M');
//ini_set('memory_limit', '320M');
//ini_set('memory_limit', '384M');
//ini_set('memory_limit', '448M');
//ini_set('memory_limit', '512M');