dee

Merge lp:~kamstrup/dee/commit-transaction-leaks into lp:dee

Proposed by Mikkel Kamstrup Erlandsen
Status: Merged
Approved by: Gord Allott
Approved revision: 280
Merged at revision: 280
Proposed branch: lp:~kamstrup/dee/commit-transaction-leaks
Merge into: lp:dee
Diff against target: 82 lines (+15/-12)
1 file modified
dee/dee-shared-model.c (+15/-12)
To merge this branch: bzr merge lp:~kamstrup/dee/commit-transaction-leaks
Reviewer Review Type Date Requested Status
Gord Allott (community) Approve
Review via email: mp+57219@code.launchpad.net

Description of the change

See bug description. I was able to reproduce the leak by making the dee master/slave example commit and clear 1000 rows each second which exacerbated the problem enough to make it very obvious.

With these fixes a 10min torture run as described does leak anything.

To post a comment you must log in.
Revision history for this message
Gord Allott (gordallott) wrote :

looks good to me and works well :)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'dee/dee-shared-model.c'
--- dee/dee-shared-model.c 2011-03-06 09:42:20 +0000
+++ dee/dee-shared-model.c 2011-04-11 19:07:25 +0000
@@ -965,11 +965,10 @@
965 dee_peer_get_swarm_name (priv->swarm));965 dee_peer_get_swarm_name (priv->swarm));
966 g_variant_unref (transaction);966 g_variant_unref (transaction);
967 return;967 return;
968 }968 }
969969
970 /* If the model has no schema then use the one received in the transaction */
970 schema = g_variant_iter_next_value (&iter);971 schema = g_variant_iter_next_value (&iter);
971
972 /* If the model has no schema then use the one received in the transaction */
973 n_cols = dee_model_get_n_columns (DEE_MODEL (self));972 n_cols = dee_model_get_n_columns (DEE_MODEL (self));
974 if (n_cols == 0)973 if (n_cols == 0)
975 {974 {
@@ -979,16 +978,17 @@
979 n_cols = column_schemas_len;978 n_cols = column_schemas_len;
980 dee_model_set_schema_full (DEE_MODEL(self), column_schemas, n_cols);979 dee_model_set_schema_full (DEE_MODEL(self), column_schemas, n_cols);
981 g_free (column_schemas);980 g_free (column_schemas);
982 g_variant_unref (schema);
983 }981 }
984 else982 else
985 {983 {
986 g_warning ("Received transaction before the model schema has been set"984 g_warning ("Received transaction before the model schema has been set"
987 " and none received from leader");985 " and none received from leader");
988 g_variant_unref (transaction);986 g_variant_unref (transaction);
987 g_variant_unref (schema);
989 return;988 return;
990 }989 }
991 }990 }
991 g_variant_unref (schema);
992992
993 /* Parse the rest of the transaction */993 /* Parse the rest of the transaction */
994 aav = g_variant_iter_next_value (&iter);994 aav = g_variant_iter_next_value (&iter);
@@ -1122,6 +1122,9 @@
1122 priv->suppress_remote_signals = FALSE;1122 priv->suppress_remote_signals = FALSE;
11231123
1124 g_variant_unref (transaction);1124 g_variant_unref (transaction);
1125 g_variant_unref (aav);
1126 g_variant_unref (au);
1127 g_variant_unref (ay);
11251128
1126 dee_serializable_model_set_seqnum (DEE_MODEL (self), seqnum_after);1129 dee_serializable_model_set_seqnum (DEE_MODEL (self), seqnum_after);
1127}1130}
@@ -1134,13 +1137,13 @@
1134 guint32 pos;1137 guint32 pos;
1135 GVariant **row;1138 GVariant **row;
11361139
1137 priv = DEE_SHARED_MODEL (self)->priv;1140 priv = DEE_SHARED_MODEL (self)->priv;
1138
1139 row_slice_size = dee_model_get_n_columns(self) * sizeof (gpointer);
1140 row = g_slice_alloc (row_slice_size);
11411141
1142 if (!priv->suppress_remote_signals)1142 if (!priv->suppress_remote_signals)
1143 {1143 {
1144 row_slice_size = dee_model_get_n_columns(self) * sizeof (gpointer);
1145 row = g_slice_alloc (row_slice_size);
1146
1144 pos = dee_model_get_position (self, iter);1147 pos = dee_model_get_position (self, iter);
1145 enqueue_revision (self,1148 enqueue_revision (self,
1146 CHANGE_TYPE_ADD,1149 CHANGE_TYPE_ADD,
@@ -1177,13 +1180,13 @@
1177 gsize row_slice_size;1180 gsize row_slice_size;
1178 GVariant **row;1181 GVariant **row;
1179 1182
1180 priv = DEE_SHARED_MODEL (self)->priv;1183 priv = DEE_SHARED_MODEL (self)->priv;
1181
1182 row_slice_size = dee_model_get_n_columns(self) * sizeof (gpointer);
1183 row = g_slice_alloc (row_slice_size);
11841184
1185 if (!priv->suppress_remote_signals)1185 if (!priv->suppress_remote_signals)
1186 {1186 {
1187 row_slice_size = dee_model_get_n_columns(self) * sizeof (gpointer);
1188 row = g_slice_alloc (row_slice_size);
1189
1187 pos = dee_model_get_position (self, iter);1190 pos = dee_model_get_position (self, iter);
1188 enqueue_revision (self,1191 enqueue_revision (self,
1189 CHANGE_TYPE_CHANGE,1192 CHANGE_TYPE_CHANGE,

Subscribers

People subscribed via source and target branches