Work in progress on a version of the spam module which uses less memory
cd sites/all/modules/spam/wget -O - http://wtanaka.com/system/files/spam-5.x-1.0-lowmem.patch.bz2 | bzcat | patch -p0
You should coordinate with the issue queue at http://drupal.org/project/spam to see if you can get this in.
As described, this was a work in progress that I never finished. I'm guessing that it's also obsolete by now. =)