how to resolve memory allocation issue on proxmox

URL Link //n.sfs.tw/13473

2019-09-21 16:27:28 By jung

在proxmox環境要新建vm,明明系統顯示記憶體仍有50%以上,但是在啟動vm時,卻失敗

if you're facing an issue of starting VM with this kind of error message below, it might be the reason that system kept too much caches of VMs,

錯誤訊息為:

ioctl(KVM_CREATE_VM) failed: 12 Cannot allocate memory
kvm: failed to initialize KVM: Cannot allocate memory

 

這時需要用一個指令將cache刪除掉

you can try to clean caches by using command as following, then use  free command to check

free && sync && echo 3 > /proc/sys/vm/drop_caches && free

 

先檢視目前記憶體狀態,再drop_caches,最後再一次檢視記憶體是否已經釋出

 

虛擬環境還是很吃記憶體的,我看還是定期清一下cache比較好,決定加入排程去處理

maybe it is better to add this job into crontab and execute it regularly