Fatal error: Out of memory – Error while upgrading WordPress

Solution:1

The only thing you could do is try and uninstall the old WordPress 3.1. Then, download WordPress 3.2.2 from the website and install the new version.

Solution:2

If you can access your PHP configuration, try increasing memory_limit to 32M or 64M and restart the web server.