Help Needed to fix Gtk/Widget.cs

Hello community!

We use Gtk# in our project for ATM (Air Traffic Management) software.

Our customer reported a memory leak when using our application.

After several months of investigation, we finally found out that the method SizeRequest of Gtk.Widget class was leaking. We found a fix for that leak on 2.12.45 branch. A patch on gtk.dll was proven to solve our memory leak because we launched endurance tests and nmon monitoring proved that memory consumption was dramaticaly reduced because of that fix. We launched Resharper Ultimate tools to investigate unmanaged memory and it showed that the solution fixed precisely the method SizeRequest memory leak.

Here is the solution we have found. The idea is to use Requisition property with the object instead of instantiating a new one every time the method is called:

public Gtk.Requisition SizeRequest() {
Gtk.Requisition requisition = Requisition;
gtk_widget_size_request(Handle, ref requisition);
return requisition;