mono / gtk-sharp

Gtk# is a Mono/.NET binding to the cross platform Gtk+ GUI toolkit and the foundation of most GUI apps built with Mono
http://www.mono-project.com/GtkSharp
Other
424 stars 140 forks source link

GTK doesn't free memory. #269

Closed dario279 closed 5 years ago

dario279 commented 5 years ago

Steps to Reproduce

  1. Open project and launch

Current Behavior

Garbage collection doesn't free memory after pop a page.

Expected Behavior

Garbage collector should free memory after pop a page.

On which platforms did you notice this

Linux

Version Used:

I tested with several of them but at the newest one (5.20.0) is happening too.

TestHMI.zip

Therzok commented 5 years ago

This seems like a Xamarin.Forms bug, rather than a Mono bug.

Profiling the test sample application shows that event handlers are not removed on widget destroy.

cc @jsuarezruiz

Therzok commented 5 years ago

@dario279 could you please file the bug against Xamarin.Forms?

Therzok commented 5 years ago

In example, WPF backend does remove the event handler on dispose: https://github.com/xamarin/Xamarin.Forms/blob/f24d6a3d6e0dd230f44273ff66e2fe04ac85a2b7/Xamarin.Forms.Platform.WPF/Renderers/ViewRenderer.cs#L322

Gtk does not: https://github.com/xamarin/Xamarin.Forms/blob/491947606d03647124bffffcea8547e135869027/Xamarin.Forms.Platform.GTK/VisualElementRenderer.cs#L209

This is not a problem solvable in gtk#

dario279 commented 5 years ago

Thank you @Therzok . I opened a bug in Xamarin forms.

knocte commented 5 years ago

( https://github.com/xamarin/Xamarin.Forms/issues/5977 )