More memory in Gallery2?

I’ve installed Gallery2 (RC1), and have found that ImageMagick fails with an out-of-memory error when resizing very large photos (3264x2448). It works fine with somewhat smaller photos. The Gallery people say this is an OS limit, but ulimit says that I have unlimited memory.

How do I change the memory limit so that when PHP calls ImageMagick, it can have more memory?