Edit: Apologies, after re-reading your post, it seems you're getting this error message randomly while playing. I'm afraid most of my answer didn't address this issue - my apologies.
The only thing I can offer is that I have less problems while running the game as Administrator. Afraid that's really the only relevant info I can provide without referencing past posts. Good luck.
I've only seen this error twice, but both times it was because the program was blocked from working as designed. I guess that could be a "memory allocation", but I found the error description to be less than helpful in troubleshooting.
The first time I got this message, I had updated my antivirus and firewall and the settings had inadvertently changed. I needed to allow the exe to get through the firewall and then everything was fine.
The second time I got this message, I had moved to offline playing and tried to run SimCity without running Origin. It would fail immediately if I blocked Origin from running (throwing the memory allocation error), and also crash to desktop with the same error if I attempted to close Origin after launching my offline city.
Based only on my own experiences, I would say double-check that you're connected to the Internet and Origin, and make sure that your firewall is allowing the game. I also find I have less problems when running as Administrator, so you may want to try that as well.