I was using VMWare Player and getting VMware: vmw_ioctl_command error Cannot allocate memory sometimes when I tried to start Gazebo. I was able to fix the problem by going into the display settings for the virtual machine and increasing the amount of graphics memory to 2GB (you might be able to get a way with less).