yum: memory alloc (12 bytes) returned NULL

Yum is a hungry sun-of-gun when it comes to memory. You are going to need more memory than this. This is one of the reasons to make sure you get burstable ram when renting a VM from a third party.

It has been a while since I used openvz, but I think you need to increase the privvmpages memory parameter (i.e. if your vz is id 100 you run the following from the host machine (not the vz):

vzctl set 100 --privvmpages 512m:1024m --save

Then you can verify that it has taken effect with by looking at the counters, /proc/user_beancounters on the host machine.

Update:
Since you are getting this from a 3rd party you need to look into burstable ram or more memory. Since this is a rented VZ, they generally won't give you swap space -- so 128 is a hard limit on the amount of memory you can allocate at a time.


128MB is not much for a centOS (and Yum), but possible. First of all, have you tried rebooting it? This will clear a lot of RAM. If that doesn't work, why don't you try to make a swap-file?

It's easy, it just takes 3 commands:

dd if=/dev/zero of=/swapfile bs=1024 count=65536
mkswap /swapfile
swapon /swapfile

The size of the swapfile is 67108864b (1024*65536). Feel free to make this larger as 64MB won't get you very far.

If you want to mount it on reboot, add this to /etc/fstab

/swapfile          swap            swap    defaults        0 0