Memory Limit

Hi guys, I took a vps with 2 CPU and 4GB of ram I use with cpanel, how much ram do I have to allocate to mysql?
A thank you

My production server memory is getting exhausted even after setting memory limit to 1 GB. What could be wrong?

What @Tool said. Also, is this happening in admin (backend) or frontend? For frontend, I'd be very concerned. For backend it might be common if you're doing import/export or backup/restore. Note that there is no problem with increasing the memory_limit value. It is a 'limit' not an 'allocation'. So PHP will use memory it needs up until it reaches that point. Then it will kill itself. If it's only in the backend and the usage seems reasonable for the task at hand then you can setup your config.local.php similar to:

if( AREA == 'A' )
  ini_set('memory_limit', '2048M'):
  ini_set('memory_limit', '512M');