Re: gobject memory usage tracking

On Wed, 22 Nov 2000, Tim Janik wrote:

> if you just want a dump out of how many objects are life per type, that
> could be implemented by adding:
> 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?

I've spent a fair amount of time trying to locate bloat in
Mozilla. Locating runtime bloat is very hard, tools like memprof gives
info on where memory is being allocated, but that almost never gives you
data enought. A better view is how much memory different kinds of objects
take, but this kind of data is very hard to get. Normally the most you get
is a profile that groups allocations by their size.

Having this in glib doesn't help Mozilla, and I don't need this for
anything else right now, but for the future it might be an interesting
hack when trying to slim down Gtk+.

/ Alex

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