mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-19 08:11:16 +00:00
miniobject: free qdata array when the last qdata is removed
In cases with many long-lived buffers that have qdata only very briefly, the memory overhead of keeping an array of 16 GstQData structs for each buffer can be significant. We free the array when the last qdata is removed, like it was done in 1.14. Fixes #436
This commit is contained in:
parent
94ba1cea88
commit
e6bd5b4193
1 changed files with 6 additions and 1 deletions
|
@ -506,7 +506,12 @@ remove_notify (GstMiniObject * object, gint index)
|
||||||
|
|
||||||
/* remove item */
|
/* remove item */
|
||||||
priv_data->n_qdata--;
|
priv_data->n_qdata--;
|
||||||
if (index != priv_data->n_qdata) {
|
if (priv_data->n_qdata == 0) {
|
||||||
|
/* we don't shrink but free when everything is gone */
|
||||||
|
g_free (priv_data->qdata);
|
||||||
|
priv_data->qdata = NULL;
|
||||||
|
priv_data->n_qdata_len = 0;
|
||||||
|
} else if (index != priv_data->n_qdata) {
|
||||||
QDATA (priv_data, index) = QDATA (priv_data, priv_data->n_qdata);
|
QDATA (priv_data, index) = QDATA (priv_data, priv_data->n_qdata);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue