Usually the default of 128M is good enough to do almost anything 10 times over. If you're running into this type of error, check for infinite loops.
Otherwise, there is no "max" except that of your physical memory on the server. If you have 8 gigs of ram, you're best to max out at around 2 gigs for PHP; however, I would NEVER do that. I'd stick with 128, maybe move to 512 to see if that allows enough memory. if 512M doesn't allow your script to run, chances are the code is doing something funky and you have a loop that is never ending in there.
If you post your code, we can take a look for ya.