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
1=== modified file 'dee/dee-shared-model.c'
2--- dee/dee-shared-model.c 2011-03-06 09:42:20 +0000
3+++ dee/dee-shared-model.c 2011-04-11 19:07:25 +0000
4@@ -965,11 +965,10 @@
5 dee_peer_get_swarm_name (priv->swarm));
6 g_variant_unref (transaction);
7 return;
8- }
9+ }
10
11+ /* If the model has no schema then use the one received in the transaction */
12 schema = g_variant_iter_next_value (&iter);
13-
14- /* If the model has no schema then use the one received in the transaction */
15 n_cols = dee_model_get_n_columns (DEE_MODEL (self));
16 if (n_cols == 0)
17 {
18@@ -979,16 +978,17 @@
19 n_cols = column_schemas_len;
20 dee_model_set_schema_full (DEE_MODEL(self), column_schemas, n_cols);
21 g_free (column_schemas);
22- g_variant_unref (schema);
23 }
24 else
25 {
26 g_warning ("Received transaction before the model schema has been set"
27 " and none received from leader");
28 g_variant_unref (transaction);
29+ g_variant_unref (schema);
30 return;
31 }
32 }
33+ g_variant_unref (schema);
34
35 /* Parse the rest of the transaction */
36 aav = g_variant_iter_next_value (&iter);
37@@ -1122,6 +1122,9 @@
38 priv->suppress_remote_signals = FALSE;
39
40 g_variant_unref (transaction);
41+ g_variant_unref (aav);
42+ g_variant_unref (au);
43+ g_variant_unref (ay);
44
45 dee_serializable_model_set_seqnum (DEE_MODEL (self), seqnum_after);
46 }
47@@ -1134,13 +1137,13 @@
48 guint32 pos;
49 GVariant **row;
50
51- priv = DEE_SHARED_MODEL (self)->priv;
52-
53- row_slice_size = dee_model_get_n_columns(self) * sizeof (gpointer);
54- row = g_slice_alloc (row_slice_size);
55+ priv = DEE_SHARED_MODEL (self)->priv;
56
57 if (!priv->suppress_remote_signals)
58 {
59+ row_slice_size = dee_model_get_n_columns(self) * sizeof (gpointer);
60+ row = g_slice_alloc (row_slice_size);
61+
62 pos = dee_model_get_position (self, iter);
63 enqueue_revision (self,
64 CHANGE_TYPE_ADD,
65@@ -1177,13 +1180,13 @@
66 gsize row_slice_size;
67 GVariant **row;
68
69- priv = DEE_SHARED_MODEL (self)->priv;
70-
71- row_slice_size = dee_model_get_n_columns(self) * sizeof (gpointer);
72- row = g_slice_alloc (row_slice_size);
73+ priv = DEE_SHARED_MODEL (self)->priv;
74
75 if (!priv->suppress_remote_signals)
76 {
77+ row_slice_size = dee_model_get_n_columns(self) * sizeof (gpointer);
78+ row = g_slice_alloc (row_slice_size);
79+
80 pos = dee_model_get_position (self, iter);
81 enqueue_revision (self,
82 CHANGE_TYPE_CHANGE,

Subscribers

People subscribed via source and target branches