does g_object_set_data() leak ?



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I'm having a suspicion that g_object_set_data() leaks. When you use
g_object_set_data(), it will store the key/data pair in a gHashTable in the
object's->data area. When the object is destroyed/freed/unref'ed, it seems to
appear that the memory used by the g_object_set_data() associations is not freed
along with the object.

I'm coming to this conclusion from a valgrind run. And yes, I know about the
switchs to use for valgrind, or shoucl I say the environment variables to set,
so that I get a good representation of what leaks, and what doesn't. My objects
in question are all properly freed, but NOT the associated g_object_set_data().

That is to say that for each usage of g_object_set_data(), I'm seeing 2 leaks.
The 1st leak is the strdup of the string passed in, the 2nd leak is the
g_quark_from_string() allocation of 16 bytes (I think this is the hash entry, or
related).

Is this a known problem ?

In general, I'm using g_object_set_data() to store pointers to various and
asundry widgets. I would have thought that when an object was destroyed, it's
set_data associations would also be destroyed/freed up. This appears not to be
the case.

How might I go about freeing up these the memory taken up by these data pointer
associations when the object is freed ? (I have noticed
g_object_set_data_full(), but the usages of g_object_set_data_full() are usually
used to unref the widget pointed to by the data argument...)

thoughts ? comments ?

many thanks, and best rgds,

- -Greg

- --
+---------------------------------------------------------------------+

Please also check the log file at "/dev/null" for additional information.
                (from /var/log/Xorg.setup.log)

| Greg Hosler                                   ghosler redhat com    |
+---------------------------------------------------------------------+
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)

iD8DBQFHeMlR404fl/0CV/QRAhOrAJ9IasT/xejOewrUQ1tSVjkRW23hHACcDiuz
NLz32Px7MceQ+CNIvO3zN2A=
=mrF8
-----END PGP SIGNATURE-----



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