Re: gobject memory usage tracking
- From: Tim Janik <timj gtk org>
- To: Alexander Larsson <alla lysator liu se>
- Cc: Gtk+ Developers <gtk-devel-list gnome org>
- Subject: Re: gobject memory usage tracking
- Date: Wed, 22 Nov 2000 12:15:14 +0100 (CET)
On Wed, 22 Nov 2000, Alexander Larsson wrote:
> A few days ago some cosmic radiation hit one of my two braincells and i
> came up with an idea. I have no idea if it is implementable, but i thought
> i would ask.
>
> Since gobject have pretty good knowledge of the types of objects, would it
> be possible to somehow keep track of the amount of objects of different
> types? This would be great in locating runtime memory bloat.
>
> If you could dump a profile of all currently used types and how much
> memory is allocated to them this would be great. It would probably have to
> be some compiletime define in gobject.
>
> Tim, is this possible?
if you just want a dump out of how many objects are life per type, that
could be implemented by adding:
G_ENABLE_DEBUG
struct _TypeNode
{
GTypePlugin *plugin;
guint n_children : 12;
guint n_supers : 8;
guint n_ifaces : 9;
guint is_classed : 1;
guint is_instantiatable : 1;
guint is_iface : 1;
+#ifdef G_ENABLE_DEBUG
+ guint n_instances;
+#endif
GType *children;
TypeData *data;
GQuark qname;
GData *static_gdata;
union {
IFaceEntry *iface_entries;
IFaceHolder *iface_conformants;
} private;
GType supers[1]; /* flexible array */
};
to the type node structure and implementing ++/-- counting on that
for object allocation and freeing. based on that, a profile can
easily be generated for the whole type node tree, including space
allocated by instance, class and interface structures. is that
what you want?
the one thing i'm wondering about, what exactly do you want this
profile data to tell you?
>
> / Alex
>
---
ciaoTJ
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]