On 10/30/25 11:38, BALATON Zoltan wrote:
I've tried to explain why I dislike that way in previous replies in this
thread but here's a short summary:
- Not piling memory regions not otherwise needed in device struct makes
it easier to understand. (Could you spot errors within the lot of boiler
plate code before clean up? Having less code makes it more comprehensible.)
Not sure what's different between
MemoryRegion foo_mr;
in the struct, versus
mr = g_new(MemoryRegion, 1);
in the realize function. It's one line either way.
- Documentation says it should work this way QOM managing memory regions
so it was meant to be that way. I'd rather fix code than documentation
as I think if it just works that's easier than loosing that convenience.No, that's *your* reading of the documentation, and it's based on the
incorrect assumption that destruction implies freeing the memory.
Akihiko explained that
(https://lore.kernel.org/qemu-devel/[email protected]/).
The memory region documentation does not exist in a void, the difference
between QOM object_initialize() and object_new() exists independent of
that documentation. It may be worth improving the QOM documentation on
the object lifecycle; that could be.
Paolo
- Allows simpler device models reusing superclasses without having to
write much boiler plate code to create a subclass.
I'll send some patches that can be discussed later.