OS X 10.5.8 - can I upgrade the OS?
Every iMac from the mid-2007 release onwards can run Yosemite, and the last model that couldn't could also only address 3GB of RAM. So it's almost certain that your iMac will be able to run Yosemite.