A project I am currently working on needs the facility to export a couple of thousand users and user profiles and I was getting out of memory errors. A quick search helped me discover that rather than editing the php.ini to increase memory for all sites on the server I can do it on an individual site basis in the settings.php file for the site.
If it doesn't already exist add the following line:
[code language="php"]ini_set('memory_limit', '16M');[/code]
...to your sites/default/settings.php file and amend the value accordingly until you achieve the upper memory limit required.
More information and alternative methods of achieving the same outcome can be found in the Increasing PHP memory limit document on the Drupal site.