On Fri, Feb 10, 2012 at 9:47 AM, Zhi Yong Wu <zwu.ker...@gmail.com> wrote: > Today i tried to create one VM with the option "-m 4000", and found it > failed with the following errors: > > Failed to allocate 4194304000 B: Cannot allocate memory > Aborted (core dumped)
Did you run on a 32-bit host? > I checked the qemu code, and found that in qemu_memalign() function, > posix_memalign() failed to allocate requested memory. Perhaps due to > No enough memory. > > But when i tried with "-m 3000", it can work. > > So i have one question about this. How to determine the supported max > memory size of one VM on one specifc host? Since QEMU may use host virtual memory for guest RAM the limit isn't a hard limit that is easy to describe. If the host OS performs memory overcommit by default (i.e. will allow processes to map memory without dedicating that amount of swap), then you can theoretically allocate up to your address space limit (32-bit or 64-bit) and won't get error until you begin dirtying more host pages than the host has resources for. But normally for KVM you want sum(vms) < host_ram, unless you are betting on KSM to deduplicate guest memory. Stefan