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 761181 - Big big memory leak: the DocumentTab's are not finalized
Big big memory leak: the DocumentTab's are not finalized
Status: RESOLVED OBSOLETE
Product: gnome-latex
Classification: Other
Component: general
3.19.x
Other Linux
: Normal critical
: unspecified
Assigned To: LaTeXila maintainer(s)
LaTeXila maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2016-01-27 15:08 UTC by Sébastien Wilmet
Modified: 2018-02-23 16:25 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Sébastien Wilmet 2016-01-27 15:08:23 UTC
A DocumentTab contains the DocumentView (subclass of GtkSourceView) which contains a Document (subclass of GtkSourceBuffer).

With a tool like gobject-list:
https://blogs.gnome.org/danni/2011/02/17/ld_preload-gobject-lifetime-debugging-tool/
https://git.collabora.com/cgit/user/danni/gobject-list.git/

We can see that the Document, DocumentView and DocumentTab objects are not finalized!! This is a huge memory leak.

A beginner writing Vala code (i.e. me several years ago) will not pay enough attention to memory handling, reference counting, avoid reference cycles and so on. In Vala, *most* of the time you don't need to pay attention to memory handling. The problem is in "most of the time"; not always… So here you have the result… the opened documents are never freed.

Also, it would be better to call gtk_widget_destroy() on a tab that we no longer need. In normal code this would break reference cycles. Except that Vala never g_object_unref() other objects in dispose(). Vala does that in finalize. Thanks Vala…
Comment 1 Sébastien Wilmet 2016-10-22 06:55:17 UTC
In document.vala, there is this instance variable:

> public DocumentTab tab;

It should be a weak ref.

Will test later.
Comment 2 Sébastien Wilmet 2017-03-04 13:12:02 UTC
I've made some progress to fix this bug:

commit 1daf96cb17bdd83e0cd83231097f17bedf46c367
commit cf118d05741565b1f543bf6430a1aa6ce53683d1
commit cba23f861067a1769605865f4d6e482806b7b8aa
Comment 3 Sébastien Wilmet 2018-02-18 11:32:19 UTC
Still not found where the reference is leaked. A possible short-term solution is to empty the GtkTextBuffer when closing a tab.
Comment 4 GNOME Infrastructure Team 2018-02-23 16:25:12 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gnome-latex/issues/35.