Commit deeabd6
authored
Check memory leaks in all tests, and fix the 3 detected (#26)
In PR #24 I started
removing memory leaks by checking them when the utility function
`with_db` was used in unit tests.
This PR finalizes that process.
It contains a new utility class `LeakChecker` that checks the leaks for
a unit test.
`LeakChecker` is added to the utility classes `ReplicationTwoDbsTester`
and `ReplicationThreeDbsTester`, used to test replication use cases.
`LeakChecker` is also added to all tests that do not use one of the
three utility function & classes.
Three new sources of memory leaks were discovered this time:
- in `src/encryptable.rs`, `reference` was used instead of
`take_ownership` when creating a new `Encryptable`
- in `src/replicator.rs`, the struct `Endpoint` was not implementing
`Drop`
- in `src/replicator.rs`, when a `Replicator` was created we were not
giving ownership of the `CBLDatabase` object to the
`CBLReplicatorConfiguration` object1 parent 97d8d9a commit deeabd6
File tree
6 files changed
+130
-25
lines changed- src
- tests
6 files changed
+130
-25
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
83 | 88 | | |
84 | 89 | | |
85 | 90 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
110 | 118 | | |
111 | 119 | | |
112 | 120 | | |
| |||
786 | 794 | | |
787 | 795 | | |
788 | 796 | | |
789 | | - | |
| 797 | + | |
790 | 798 | | |
791 | 799 | | |
792 | 800 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| |||
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
| 70 | + | |
69 | 71 | | |
70 | 72 | | |
71 | 73 | | |
| |||
147 | 149 | | |
148 | 150 | | |
149 | 151 | | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
150 | 155 | | |
151 | 156 | | |
152 | 157 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
11 | 15 | | |
12 | 16 | | |
13 | 17 | | |
| |||
18 | 22 | | |
19 | 23 | | |
20 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
21 | 28 | | |
22 | 29 | | |
23 | 30 | | |
| |||
70 | 77 | | |
71 | 78 | | |
72 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
73 | 83 | | |
74 | 84 | | |
75 | 85 | | |
| |||
87 | 97 | | |
88 | 98 | | |
89 | 99 | | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
90 | 103 | | |
91 | 104 | | |
92 | 105 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
23 | 26 | | |
24 | 27 | | |
25 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
26 | 32 | | |
27 | 33 | | |
28 | 34 | | |
| |||
38 | 44 | | |
39 | 45 | | |
40 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
41 | 50 | | |
42 | 51 | | |
43 | 52 | | |
| |||
82 | 91 | | |
83 | 92 | | |
84 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
85 | 97 | | |
86 | 98 | | |
87 | 99 | | |
| |||
116 | 128 | | |
117 | 129 | | |
118 | 130 | | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
119 | 134 | | |
120 | 135 | | |
121 | 136 | | |
| |||
132 | 147 | | |
133 | 148 | | |
134 | 149 | | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
135 | 153 | | |
136 | 154 | | |
137 | 155 | | |
| |||
152 | 170 | | |
153 | 171 | | |
154 | 172 | | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
155 | 176 | | |
156 | 177 | | |
157 | 178 | | |
| |||
170 | 191 | | |
171 | 192 | | |
172 | 193 | | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
173 | 197 | | |
174 | 198 | | |
175 | 199 | | |
| |||
182 | 206 | | |
183 | 207 | | |
184 | 208 | | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
185 | 212 | | |
186 | 213 | | |
187 | 214 | | |
| |||
202 | 229 | | |
203 | 230 | | |
204 | 231 | | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
205 | 235 | | |
206 | 236 | | |
207 | 237 | | |
| |||
210 | 240 | | |
211 | 241 | | |
212 | 242 | | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
213 | 246 | | |
214 | 247 | | |
215 | 248 | | |
| |||
222 | 255 | | |
223 | 256 | | |
224 | 257 | | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
225 | 261 | | |
226 | 262 | | |
227 | 263 | | |
| |||
0 commit comments