Add a way to get the memory consumption of a string list
This is just for tests, and not meant to be merged. I want to be able to compare the data structure size for various string list implementations.
This commit is contained in:
@@ -581,3 +581,9 @@ gtk_string_list_get_string (GtkStringList *self,
|
||||
|
||||
return objects_get (&self->items, position)->string;
|
||||
}
|
||||
|
||||
guint64
|
||||
gtk_string_list_get_size (GtkStringList *self)
|
||||
{
|
||||
return sizeof (GtkStringList) + (self->items.end_allocation - self->items.start) * sizeof (gpointer);
|
||||
}
|
||||
|
||||
@@ -69,6 +69,9 @@ GDK_AVAILABLE_IN_ALL
|
||||
const char * gtk_string_list_get_string (GtkStringList *self,
|
||||
guint position);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
guint64 gtk_string_list_get_size (GtkStringList *self);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_STRING_LIST_H__ */
|
||||
|
||||
Reference in New Issue
Block a user