On 01/05/2015 03:18, Michael Roth wrote: > Sorry, I mixed up memory regions with memory region alias. Memory region > aliases do a memory_region_ref() on the original MR, similar to > memory_region_add_subregion(), so that's what ends up creating the > reference to the owner/PHB. > > So I think I do need to object_unparent() the 2 MR aliases in realize > (otherwise the PHB doesn't get finalized), but everything else can > get moved to instance_finalize() as you suggested and that seems to > do the trick.
Yes, unparenting the aliases in unrealize is okay and in fact may be required to avoid a leak. Patching docs/memory.txt to point it out would be great. :) Paolo