New debug option for GObject



I submitted this to Bugzilla awhile back and forgot about it.  Today I
stumbled across it again and thought I'd try to elicit some feedback.

See: http://bugzilla.gnome.org/show_bug.cgi?id=354457

This is a proposal for a new GType debug option whereby instance
creation and destruction is tracked per GType and statistics are
reported at program termination, similar to the "stale references"
option for GObject.  This works not just for GObjects but for any
instantiable GType and is meant to compliment the existing options.

The statistics reported are, for each instantiated GType, the number of
instances created, the number destroyed, and the maximum population
during runtime.  This information could be used to help with performance
tuning, memory usage analysis, or tracking down memory leaks.

The output looks like:
GLib-GObject-Message: <type-name> | created <n> | destroyed <n> | max
population <n>

The option is activated by compiling GLib with debugging features
enabled and either passing a debug flag (G_TYPE_DEBUG_TYPES) to
g_type_init_with_debug_flags() or including the keyword "types" in the
environment variable GOBJECT_DEBUG.

The bug report has more details and a patch.

Does anyone else think this capability would be valuable?

Matthew Barnes




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