On Mar 31, 2008, at 16:28, Daniel P. Berrange wrote:
The problem is that you are not freeing the virDomainPtr object after you undefine the first VM. Libvirt caches virDomainPtr objects based on the 'name' value. So the second time around you are getting the cached handle. You are also leaking memory. You need to call virDomainFree(virDomainPtr dom) to actually release the handle.
I could not figure out how this could be expressed via Ruby bindings. This function is called when object is freed, but when it happens is controlled by GC.
For example, KDE Ruby binding are using dispose() method paradigm to solve this kind of problem:
http://developer.kde.org/language-bindings/ruby/ Should we add one to Domain class? Sincerely, VadimP.S. I think the Python bindings have the same problem, virDomainPtr() is called from __del__() there.
-- "La perfection est atteinte non quand il ne reste rien a ajouter, mais quand il ne reste rien a enlever." (Antoine de Saint-Exupery)
Description: S/MIME cryptographic signature