After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 735547 - Plug the memory leaks
Plug the memory leaks
Status: RESOLVED FIXED
Product: five-or-more
Classification: Applications
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: five-or-more-maint
five-or-more-maint
Depends on:
Blocks:
 
 
Reported: 2014-08-27 19:50 UTC by Robert Roth
Modified: 2016-09-20 09:46 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Unref the UI builders (935 bytes, patch)
2014-08-27 19:58 UTC, Robert Roth
committed Details | Review
No new game confirmation before first move (bgo #736989) (2.81 KB, patch)
2015-01-01 14:39 UTC, Robert Roth
rejected Details | Review
Do not get pixbuf formats to free it (708 bytes, patch)
2015-01-09 15:53 UTC, Robert Roth
committed Details | Review
Fixed various possible memory leaks. (5.67 KB, patch)
2015-01-09 21:06 UTC, Robert Roth
committed Details | Review

Description Robert Roth 2014-08-27 19:50:09 UTC
After simply running five-or-more, opening preferences, closing preferences, and closing the main window, here's what I got from valgrind: ('valgrind --tool=memcheck five-or-more')

==3812== LEAK SUMMARY:
==3812==    definitely lost: 3,856 bytes in 7 blocks
==3812==    indirectly lost: 21,717 bytes in 928 blocks
==3812==      possibly lost: 57,136 bytes in 851 blocks
==3812==    still reachable: 5,029,611 bytes in 80,121 blocks
==3812==         suppressed: 0 bytes in 0 blocks
Comment 1 Robert Roth 2014-08-27 19:58:04 UTC
Created attachment 284636 [details] [review]
Unref the UI builders
Comment 2 Michael Catanzaro 2014-08-27 23:15:09 UTC
Review of attachment 284636 [details] [review]:

Thanks!
Comment 3 Michael Catanzaro 2014-08-28 14:48:48 UTC
Are there more leaks, or did you forget to close the bug?
Comment 4 Robert Roth 2014-08-28 14:58:33 UTC
Yes, I have found some more, but no patches yet, will check out those and will close the bug when I'm happy with the valgrind results :)
Comment 5 Robert Roth 2015-01-01 14:39:21 UTC
Created attachment 293558 [details] [review]
No new game confirmation before first move (bgo #736989)
Comment 6 Robert Roth 2015-01-01 14:40:51 UTC
Comment on attachment 293558 [details] [review]
No new game confirmation before first move (bgo #736989)

Whoops, attached to the wrong bug.
Comment 7 Robert Roth 2015-01-09 15:53:28 UTC
Created attachment 294169 [details] [review]
Do not get pixbuf formats to free it
Comment 8 Michael Catanzaro 2015-01-09 16:17:23 UTC
Review of attachment 294169 [details] [review]:

Please commit this to gnome-robots as well.
Comment 9 Robert Roth 2015-01-09 18:41:20 UTC
Review of attachment 294169 [details] [review]:

Committed to both gnome-robots and five-or-more.
Comment 10 Robert Roth 2015-01-09 21:06:57 UTC
Created attachment 294183 [details] [review]
Fixed various possible memory leaks.

* Made some global variables local-only
* Free objects as soon as possible
* Make sure cleanup is called both on quit and close
Comment 11 Michael Catanzaro 2015-01-10 04:24:58 UTC
Review of attachment 294183 [details] [review]:

::: src/five-or-more.c
@@ +1462,3 @@
+  int i = 0;
+
+  for (i = 0; i < G_N_ELEMENTS(preview_images); i++)

missing space

@@ +1469,3 @@
+    g_object_unref (ball_preimage);
+    ball_preimage = NULL;
+  }

This entire conditional:

if (ball_preimage) {
	g_object_unref (ball_preimage);
	ball_preimage = NULL;
}

Is equivalent to:

g_clear_object (&ball_preimage);
Comment 12 Robert Roth 2015-01-10 06:37:51 UTC
Review of attachment 294183 [details] [review]:

Committed with the suggested changes.
Comment 13 Robert Roth 2016-09-20 09:45:56 UTC
As the memory leaks found so far have been fixed, I am marking this as fixed, other memory leaks found should be handled in separate bug reports.
Comment 14 Robert Roth 2016-09-20 09:46:07 UTC
This problem has been fixed in our software repository. The fix will go into the next software release. Once that release is available, you may want to check for a software upgrade provided by your Linux distribution.