Add the following to your wp-config.php file to set a certain amount of memory that WordPress is allowed to use.

define( 'WP_MEMORY_LIMIT', '32M' );

In this example the memory limit is 32 MB. The memory limit must contain a M after the number, as the limit is in megabytes.