I have run across a few models of the 2008-2009 MacBook Pro in which the unit fails to boot and you get the endless circle on a grey screen.  Usually this indicates a corrupted drive or the need to use Diskwarrior or a completely broken drive.    But in the case of these units even after replacing the drive or trying to partition you still get left with an error cannot allocate memory POSIX, etc the problem turns out problem is likely the SATA ribbon cable.

(Faulty SATA Cable with HD Bracket)

This cable is not hard to access inside the machine and has a SATA connection along with a temperature module.  I went ahead and replace the entire bracket with the thermal monitor and SATA cable but you can buy just the cable online . (ifixit.com)

The original cable was glued to the bottom of the case and opted for two pieces of electrical tape to keep cable in line by the DVD drive.

New cable and machine good as new.