Bug 18457 - Memory not free with Dispose
Summary: Memory not free with Dispose
Alias: None
Product: Class Libraries
Classification: Mono
Component: Mono.Cairo ()
Version: 3.2.x
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2014-03-19 05:38 UTC by KOEHLER Christophe
Modified: 2018-03-13 11:07 UTC (History)
1 user (show)

Is this bug a regression?: ---
Last known good build:

Source code for display an ip camera snapshot in a drawing area (20.00 KB, application/x-gzip)
2014-03-19 05:38 UTC, KOEHLER Christophe

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description KOEHLER Christophe 2014-03-19 05:38:39 UTC
Created attachment 6351 [details]
Source code for display an ip camera snapshot in a drawing area


I built a little example for using a webcam (ip camera) and loading snapshot from it and display it in a drawing area.
This application have to run 24h/24 7d/7.
I used the linux command 'top' to show memory usage and I saw that it increase slowly but endless.

I think the problem is in the execution of this part of the code which is called each time a snapshot is take :

	protected void RefreshyDisplay (){
		Application.Invoke (delegate(object sender, EventArgs e) {

			if ( image != null ){
				Cairo.Context gr = Gdk.CairoHelper.Create(daCamera.GdkWindow);

I joined the source code build with Monodevelop.
Comment 1 Mikayla Hutchinson [MSFT] 2014-03-22 16:40:32 UTC
What version of Mono.Cairo?

There was a wrapper leak that was fixed in https://github.com/mono/mono/commit/7fb3dc1e9f0eb28bc0f3de58968979d22ec2c6ad
Comment 2 KOEHLER Christophe 2014-03-24 09:13:52 UTC
Console.WriteLine ("Cairo version : "+Assembly.GetAssembly( typeof(Cairo.Context) ).GetName());


Cairo version : Mono.Cairo, Version=, Culture=neutral, PublicKeyToken=0738eb9f132ed756
Comment 3 Mikayla Hutchinson [MSFT] 2014-03-26 14:20:14 UTC
The assembly version is not useful since it's frozen. We need the Mono version/commit that it was build from.
Comment 4 KOEHLER Christophe 2014-03-27 12:56:22 UTC
I use the mono version 3.2.8-138.1  in opensuse 12.3 from the repository http://download.opensuse.org/repositories/Mono:/Factory/openSUSE_12.3
Comment 5 Mikayla Hutchinson [MSFT] 2014-04-02 18:59:26 UTC
I took a look through the Mono.Cairo calls and they look fine. What makes you think the leak is in Mono.Cairo and not Cairo or GTK?

Also, what's the purpose of the "gr.GetTarget().Dispose();"? That's a no-op.

FWIW, you app will not deal with redraw correctly. Better would be to call QueueDraw from your Application.Invoke, and do the drawing from an Expose event handler.
Comment 6 Marek Safar 2018-03-13 11:07:12 UTC
We have not received the requested information. If you are still experiencing this issue please provide all the requested information and reopen the bug report.

Thank you!