qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] qobject: Replace property list with GHashTable


From: Pavel Fedin
Subject: Re: [Qemu-devel] [PATCH] qobject: Replace property list with GHashTable
Date: Wed, 07 Oct 2015 10:53:46 +0300

 Hello!

> Hmm.. modifying a child object internally should be fine, shouldn't
> it?  IIUC only trying to remove it, change the key or the pointer to
> the value should be problematic.

 The glib documentation says that "Modifying the hash table after calling this 
function invalidates
the returned iterator". glib even includes an optional checks for this (under 
#ifndef
G_DISABLE_ASSERT): https://github.com/GNOME/glib/blob/master/glib/ghash.c#L782
 But, if you look, for example, inside  g_hash_table_iter_remove(), you'll see 
that they do exactly
the same (just remove the element), and then work around own check by 
incrementing both versions.

> How much extra memory does each Object take with no (or few) properties by
> using a hash table rather than a simple list here?

 I believe not a lot. GHashTable consists of 7 interers + 7 pointers:
https://github.com/GNOME/glib/blob/master/glib/ghash.c#L212
        
Kind regards,
Pavel Fedin
Expert Engineer
Samsung Electronics Research center Russia





reply via email to

[Prev in Thread] Current Thread [Next in Thread]