memprof: add section for allocation leaks

These are defined by allocation records that do not have a corresponding
release record.
This commit is contained in:
Christian Hergert
2021-11-04 21:08:23 -07:00
parent 0518cae7f9
commit 7a040a6032
4 changed files with 265 additions and 0 deletions

View File

@ -62,6 +62,7 @@ typedef struct
GtkRadioButton *summary;
GtkRadioButton *all_allocs;
GtkRadioButton *temp_allocs;
GtkRadioButton *leaked_allocs_button;
GtkLabel *temp_allocs_count;
GtkLabel *num_allocs;
GtkLabel *leaked_allocs;
@ -1029,6 +1030,8 @@ mode_notify_active (SysprofMemprofPage *self,
do_allocs (self, SYSPROF_MEMPROF_MODE_ALL_ALLOCS);
else if (button == priv->temp_allocs)
do_allocs (self, SYSPROF_MEMPROF_MODE_TEMP_ALLOCS);
else if (button == priv->leaked_allocs_button)
do_allocs (self, SYSPROF_MEMPROF_MODE_LEAKED_ALLOCS);
}
}
@ -1147,6 +1150,7 @@ sysprof_memprof_page_class_init (SysprofMemprofPageClass *klass)
gtk_widget_class_bind_template_child_private (widget_class, SysprofMemprofPage, temp_allocs_count);
gtk_widget_class_bind_template_child_private (widget_class, SysprofMemprofPage, num_allocs);
gtk_widget_class_bind_template_child_private (widget_class, SysprofMemprofPage, leaked_allocs);
gtk_widget_class_bind_template_child_private (widget_class, SysprofMemprofPage, leaked_allocs_button);
gtk_widget_class_bind_template_child_private (widget_class, SysprofMemprofPage, peak_allocs);
bindings = gtk_binding_set_by_class (klass);
@ -1182,6 +1186,11 @@ sysprof_memprof_page_init (SysprofMemprofPage *self)
G_CALLBACK (mode_notify_active),
self,
G_CONNECT_SWAPPED);
g_signal_connect_object (priv->leaked_allocs_button,
"notify::active",
G_CALLBACK (mode_notify_active),
self,
G_CONNECT_SWAPPED);
g_signal_connect_object (priv->summary,
"notify::active",
G_CALLBACK (mode_notify_active),

View File

@ -44,6 +44,15 @@
<property name="group">summary</property>
</object>
</child>
<child>
<object class="GtkRadioButton" id="leaked_allocs_button">
<property name="label" translatable="yes">Leaked Allocations</property>
<property name="draw-indicator">false</property>
<property name="visible">true</property>
<property name="active">false</property>
<property name="group">summary</property>
</object>
</child>
</object>
</child>
</object>