From: Pavel Fedin <p.fedin@samsung.com>
To: 'David Gibson' <david@gibson.dropbear.id.au>
Cc: 'Paolo Bonzini' <pbonzini@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] qobject: Replace property list with GHashTable
Date: Wed, 07 Oct 2015 10:53:46 +0300 [thread overview]
Message-ID: <014a01d100d5$4bfe8320$e3fb8960$@samsung.com> (raw)
In-Reply-To: <20151006235504.GP3861@voom.fritz.box>
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
prev parent reply other threads:[~2015-10-07 7:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-06 12:41 [Qemu-devel] [PATCH] qobject: Replace property list with GHashTable Pavel Fedin
2015-10-06 13:02 ` Laszlo Ersek
2015-10-06 13:15 ` Paolo Bonzini
2015-10-06 13:36 ` Pavel Fedin
2015-10-06 23:56 ` David Gibson
2015-10-06 23:55 ` David Gibson
2015-10-07 7:53 ` Pavel Fedin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='014a01d100d5$4bfe8320$e3fb8960$@samsung.com' \
--to=p.fedin@samsung.com \
--cc=david@gibson.dropbear.id.au \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).