After Effects CS4 is a 31-bit application, it cannot see more than 4 GB of RAM.
CS4 is 32bit. It will never use more than 4GB. Basic computer math. Simply consider turning off MP rendering to free up more RAM for the primary render instance. Shadow map size defaults to "comp size", but of course you may be able to reduce it. Check the advanced comp settings. Beyond that simply render to an image sequence so you can resume from the point of the crash/ hang without losing all your rendered stuff, then assemble the iamges to a clip file in a second pass.
When you are running out of memory, turn off "Render Multiple Frames." The recommendation is to have at 4GB of RAM per CPU/core you are using for AE. With four cores, you want to have 16 GB dedicated to AE (plus enough RAM for your OS and other applications.
Tip: If you render to an image sequence, it's easy to continue rendering from where the last render failed.