rewrite memory definition in libvirt.rb
minor refactoring: use simpler method