.
Does it freeze when a specific application or DATA file is loaded? Does it freeze when its inner temps are hot? Do you have a memory upgrade installed? If so, what is the "memory chips" maker's name? And, what the memory chip install pattern in your specific iMac as well?
Try these things and let us know....
-------
A few months back, I remember reading about a computer system freezing and long story short, it was its 3rd party movie player application causing the problem.
To check inner temps, load istats Nano and manually record temp settings every 5 minutes. Perhaps its internals are "too hot" and its doing an auto-shut down? Or, locking up before it can perform its "last resort" auto shut-down routine.
A few months back, I remember reading that one memory chip maker had a bad batch of chips. Some makers have the odd "bad batch" and when that extra memory is under load, it locks the computer up.
--------